[fpc-pascal] deprecated syntax is inconsistent.

2010-04-29 Thread Graeme Geldenhuys

Hi,

Why is the usage of 'deprecated' inconsistent, depending where you use it.
I'm using the ObjFPC compiler mode.

  TRGBTriple = record
Red: word;
Green: word;
Blue: word;
Alpha: word;
  end deprecated;// <<- Note: no semi-colon after 'end'.

vs

  TRGBTriple = record
Red: word;
Green: word;
Blue: word;
Alpha: word;
  end; deprecated;


The last example makes more sense because it is a type of hint/modifier
(similar to override, virtual etc), and that is how it is used in
functions/procedures?

eg:
  procedure MyProc; deprecated;
  function CalcMe(AParam: integer): boolean; deprecated;



Regards,
  - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://opensoft.homeip.net/fpgui/

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] deprecated syntax is inconsistent.

2010-04-29 Thread Marco van de Voort
In our previous episode, Graeme Geldenhuys said:
> 
> Why is the usage of 'deprecated' inconsistent, depending where you use it.

As always, because Delphi does. See the recently submitted fcl-passrc
bugreports for more examples.

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] deprecated syntax is inconsistent.

2010-04-29 Thread Graeme Geldenhuys
Marco van de Voort het geskryf:
> In our previous episode, Graeme Geldenhuys said:
>> Why is the usage of 'deprecated' inconsistent, depending where you use it.
> 
> As always, because Delphi does. See the recently submitted fcl-passrc
> bugreports for more examples.


Shouldn't that inconsistent syntax be limited to the Delphi compiler mode
only? Like many other things are.



Regards,
  - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://opensoft.homeip.net/fpgui/

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] deprecated syntax is inconsistent.

2010-04-29 Thread Jonas Maebe


On 29 Apr 2010, at 10:52, Graeme Geldenhuys wrote:


Marco van de Voort het geskryf:

In our previous episode, Graeme Geldenhuys said:
Why is the usage of 'deprecated' inconsistent, depending where you  
use it.


As always, because Delphi does. See the recently submitted fcl-passrc
bugreports for more examples.


Shouldn't that inconsistent syntax be limited to the Delphi compiler  
mode

only? Like many other things are.


The general reason for putting modifiers before the semicolon in case  
of type declarations is that there can be ambiguity in other cases  
(modifiers are not reserved words, so in principle the modifier can  
also be used as a type or variable name).


In case procedures/function/method declarations, this is not the case  
since an identifier can never follow a function/procedure/method  
declaration: they have to be preceded either by

* "procedure"/"function" for routine declarations
* by "var"/"const"/"type" for var/const/type declarations
* by "property" for property declarations
* by "public"/"(strict) protected"/"(strict) private for field  
declarations


Conversely, adding it before the semicolon in case of procedure/ 
function declarations would be inconsistent with how other modifiers  
have always been used there.


So no, it should not be changed in FPC mode like many other things  
have been changed in the past, because it would have to be changed  
back later anyway (just like http://wiki.freepascal.org/User_Changes_Trunk#Passing_derived_classes_to_var-_and_out-parameters 
, http://wiki.freepascal.org/User_Changes_2.4.0#Order_of_field_and_method.2Fproperty_declarations 
 etc)



Jonas
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] deprecated syntax is inconsistent.

2010-04-29 Thread Marco van de Voort
In our previous episode, Graeme Geldenhuys said:
> > As always, because Delphi does. See the recently submitted fcl-passrc
> > bugreports for more examples.
> 
> Shouldn't that inconsistent syntax be limited to the Delphi compiler mode
> only? Like many other things are.

IMHO no.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] deprecated syntax is inconsistent.

2010-04-29 Thread Graeme Geldenhuys
Jonas Maebe het geskryf:
> 
> Conversely, adding it before the semicolon in case of procedure/ 
> function declarations would be inconsistent with how other modifiers  
> have always been used there.

I don't have problems with it's usage in procedures, functions or methods.
The modifier appearing after the semicolon seems like the correct syntax,
and that is how 'virtual', 'override' etc is used. This I think is correct
and should stay as is.


The issue I do have is using deprecated in a type declaration, where it
appears *before* the semicolon. This just doesn't look or feel right. It
affects variable, class and record declarations. This is what I was talking
about and think should be fixed in objfpc mode and inconsistent usage
limited to only delphi mode.


Regards,
  - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://opensoft.homeip.net/fpgui/

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] deprecated syntax is inconsistent.

2010-04-29 Thread Michael Van Canneyt



On Thu, 29 Apr 2010, Graeme Geldenhuys wrote:


Jonas Maebe het geskryf:


Conversely, adding it before the semicolon in case of procedure/
function declarations would be inconsistent with how other modifiers
have always been used there.


I don't have problems with it's usage in procedures, functions or methods.
The modifier appearing after the semicolon seems like the correct syntax,
and that is how 'virtual', 'override' etc is used. This I think is correct
and should stay as is.


The issue I do have is using deprecated in a type declaration, where it
appears *before* the semicolon. This just doesn't look or feel right. It
affects variable, class and record declarations. This is what I was talking
about and think should be fixed in objfpc mode and inconsistent usage
limited to only delphi mode.


Jonas tried to explain that this is not possible.

Consider the following - what  you propose - statements:

Var
  A : Integer;
  deprecated : Boolean;

The compiler cannot decide whether the 'deprecated' is a modifier or the
name of a variable. Both are possible (deprecated is NOT a keyword) and
valid.

With the current syntax:

Var
  A : Integer deprecated;
  Deprecated : Boolean;

The compiler knows in both cases what is meant.

The matter could be resolved by making 'deprecated' and all other modifiers
into keywords, but that would be a major backwards incompatibility.


Michael.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] deprecated syntax is inconsistent.

2010-04-29 Thread Graeme Geldenhuys
Michael Van Canneyt het geskryf:
> 
> Jonas tried to explain that this is not possible.

Yes, but it is still very easy to detect the difference... I'll use your
example:


> Consider the following - what  you propose - statements:
> 
> Var
>A : Integer;
>deprecated : Boolean;
> 
> The compiler cannot decide whether the 'deprecated' is a modifier or the

Yes it can, because in your example 'deprecated' is followed by a colon and
a type.

 Var
A : Integer; deprecated;

This is *not* ambiguous at all, because the hint directive is immediately
followed by a semicolon. That is not the case in a type declaration like
you showed. A pretty clear difference.


> 
> Var
>A : Integer deprecated;
>Deprecated : Boolean;

My suggestion could still work...

 Var
A: Integer; deprecated;
Deprecated: Boolean;

One is a hint directive because it follows a (type with) semicolon and is
immediately followed by another semicolon.  The type declaration is
followed by a colon and a type. This looks pretty clear to me, and not
ambiguous at all.



Regards,
  - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://opensoft.homeip.net/fpgui/

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] deprecated syntax is inconsistent.

2010-04-29 Thread Jonas Maebe


On 29 Apr 2010, at 12:00, Graeme Geldenhuys wrote:


Michael Van Canneyt het geskryf:

Consider the following - what  you propose - statements:

Var
  A : Integer;
  deprecated : Boolean;

The compiler cannot decide whether the 'deprecated' is a modifier  
or the


Yes it can, because in your example 'deprecated' is followed by a  
colon and

a type.

Var
   A : Integer; deprecated;

This is *not* ambiguous at all,


It is ambiguous to the compiler, as is explained in one of the links I  
posted previously: http://wiki.freepascal.org/User_Changes_2.4.0#Order_of_field_and_method.2Fproperty_declarations


"The above code was ambiguous to the compiler, because when it  
finished parsing the property, it could not decide based on seeing the  
default token whether this meant that the property was a default  
property, or whether a field coming after the property was called  
"default". It did find this out after it had parsed the default token  
(because the next token was a ":" rather than a ";"), but by then it  
was too late."


The compiler uses only a single lookahead token, while disambiguating  
your example would require two.



Jonas

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] deprecated syntax is inconsistent.

2010-04-29 Thread ik
On Thu, Apr 29, 2010 at 13:39, Jonas Maebe wrote:

>
> On 29 Apr 2010, at 12:00, Graeme Geldenhuys wrote:
>
>  Michael Van Canneyt het geskryf:
>>
>>> Consider the following - what  you propose - statements:
>>>
>>>
>>> Var
>>>  A : Integer;
>>>  deprecated : Boolean;
>>>
>>> The compiler cannot decide whether the 'deprecated' is a modifier or the
>>>
>>
>> Yes it can, because in your example 'deprecated' is followed by a colon
>> and
>> a type.
>>
>> Var
>>   A : Integer; deprecated;
>>
>> This is *not* ambiguous at all,
>>
>
> It is ambiguous to the compiler, as is explained in one of the links I
> posted previously:
> http://wiki.freepascal.org/User_Changes_2.4.0#Order_of_field_and_method.2Fproperty_declarations
>
> "The above code was ambiguous to the compiler, because when it finished
> parsing the property, it could not decide based on seeing the default token
> whether this meant that the property was a default property, or whether a
> field coming after the property was called "default". It did find this out
> after it had parsed the default token (because the next token was a ":"
> rather than a ";"), but by then it was too late."
>
> The compiler uses only a single lookahead token, while disambiguating your
> example would require two.
>

I probably missing something here but how does the compiler knows about
override, cdecl etc... directives in one pass ?


>
>
> Jonas
>
>
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>

Ido
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] deprecated syntax is inconsistent.

2010-04-29 Thread Marco van de Voort
In our previous episode, ik said:

> > The compiler uses only a single lookahead token, while disambiguating your
> > example would require two.
> >
> 
> I probably missing something here but how does the compiler knows about
> override, cdecl etc... directives in one pass ?

A procedure declaration never is followed by an identifier, so the ambiguity
doesn't exist there. (at least not after the 2.4.0 fixes)
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] deprecated syntax is inconsistent.

2010-04-29 Thread Graeme Geldenhuys
On 29 April 2010 12:39, Jonas Maebe  wrote:
>
> The compiler uses only a single lookahead token, while disambiguating your
> example would require two.

I did look at the links you posted and still couldn't see the problem.
The paragraph above gives the key information -  the FPC parses only
uses a single lookahead.

This still seems rather trivial to fix - resulting in a bit more sane
syntax. Simply keep an extra backpointer, so that when the compiler
finally knows what 'default' (wiki example) or 'deprecated' (my
example) relates to, that it can still apply the hint directive by
using the backpointer.  Or (like I have seen in many pascal parsers
before), allow for more than one lookahead. I have frequently seen
object pascal parsers allow for 3 lookaheads (parser available in
PSP/PWU web framework does this).

It seems rather silly to limit the syntax (wiki example) or force a
rather weird inconsistent syntax (my example) on the developers when
the parser could easily be fixed.

More examples:
fpdoc often uses back pointers to write LaTeX or IPF output. Also, it
would imagine the parsing would be pretty similar to what FPC already
does with:  ; virtual; abstract;
After the method declaration, it has to keep track of that so it can
apply 'virtual', and then again 'abstract' to it.

Out of interest, I am looking at the fcl-passrc to see if I can modify
it to work with my suggested syntax. I don't know the code at all, so
it might take longer than normal. But it should show it is quite
possible.

-- 
Regards,
  - Graeme -


___
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] deprecated syntax is inconsistent.

2010-04-29 Thread Michael Van Canneyt



On Thu, 29 Apr 2010, Graeme Geldenhuys wrote:


On 29 April 2010 12:39, Jonas Maebe  wrote:


The compiler uses only a single lookahead token, while disambiguating your
example would require two.


I did look at the links you posted and still couldn't see the problem.
The paragraph above gives the key information -  the FPC parses only
uses a single lookahead.


As far as I remember, this was one of the key strengths of the Pascal
Language: that parsing is possible using a single lookahead token.
(it makes for faster parsing)

The other parsers simply parse the source 'wrong', hence they need
more than one lookahead.

Michael.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] deprecated syntax is inconsistent.

2010-04-29 Thread Florian Klaempfl
Michael Van Canneyt schrieb:
> 
> 
> On Thu, 29 Apr 2010, Graeme Geldenhuys wrote:
> 
>> On 29 April 2010 12:39, Jonas Maebe  wrote:
>>>
>>> The compiler uses only a single lookahead token, while disambiguating
>>> your
>>> example would require two.
>>
>> I did look at the links you posted and still couldn't see the problem.
>> The paragraph above gives the key information -  the FPC parses only
>> uses a single lookahead.
> 
> As far as I remember, this was one of the key strengths of the Pascal
> Language: that parsing is possible using a single lookahead token.

Having a bigger lookahead makes a lot more things far more complex
epecially in combination with include files, macros, generics.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] deprecated syntax is inconsistent.

2010-04-29 Thread Graeme Geldenhuys
On 29 April 2010 14:51, Florian Klaempfl  wrote:
>
> Having a bigger lookahead makes a lot more things far more complex
> epecially in combination with include files, macros, generics.

Why?  You only apply the extra lookaheads where needed (code that
could be ambiguous). All other parts of the code will be parsed as
normal - as it is done now.

So far I know of only two examples where extra lookaheads need to be used.
  * wiki example where 'default' is used
  * my example to fix the inconsistent syntax for hint directives (deprecated).

-- 
Regards,
  - Graeme -


___
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] deprecated syntax is inconsistent.

2010-04-29 Thread Graeme Geldenhuys
On 29 April 2010 14:48, Michael Van Canneyt  wrote:
>
> As far as I remember, this was one of the key strengths of the Pascal
> Language: that parsing is possible using a single lookahead token.
> (it makes for faster parsing)

And because of that age old statement, we now have to live with
inconsistent syntax. I'd rather vote for consistent syntax compared to
loosing a millisecond here and there while parsing.

The 'Hint Directive' syntax is so bad that it couldn't even be
described in the documentation via the syntax diagrams (Language
Reference - section 1.5). That says a lot.


-- 
Regards,
  - Graeme -


___
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] deprecated syntax is inconsistent.

2010-04-29 Thread Florian Klaempfl
Graeme Geldenhuys schrieb:
> On 29 April 2010 14:51, Florian Klaempfl  wrote:
>> Having a bigger lookahead makes a lot more things far more complex
>> epecially in combination with include files, macros, generics.
> 
> Why?  

Because you've always to take care of the possible extra lookahead. The
scanner knows nothing about syntax.

> You only apply the extra lookaheads where needed (code that
> could be ambiguous). All other parts of the code will be parsed as
> normal - as it is done now.
> 
> So far I know of only two examples where extra lookaheads need to be used.
>   * wiki example where 'default' is used
>   * my example to fix the inconsistent syntax for hint directives 
> (deprecated).
> 

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] deprecated syntax is inconsistent.

2010-04-29 Thread Aleksa Todorovic
During my experiments with FPC, I had to to exactly that - support two
lookahead symbols - to implement (in)famous semicolon before 'else'.
One of problems I had was combination of macros and include files with
two lookahead symbols - I "fixed" it in a dirty way, but I'm not
completely sure that solution covered all possible situations.

Just think of include directive which includes file in which there is
macro which expands to 'deprecated'. That wouldn't be that easy with
two lookahead symbols, because you would have to keep lots of data
about both symbols (they could be in two different files, for
example). Now, just think of refactoring in FPC on such low level -
doesn't smell good at all :-)

I would rather stick to on lookahead symbol even if that means
"inconsistent" (subject to this discussion) syntax.


On Thu, Apr 29, 2010 at 14:55, Graeme Geldenhuys
 wrote:
> On 29 April 2010 14:51, Florian Klaempfl  wrote:
>>
>> Having a bigger lookahead makes a lot more things far more complex
>> epecially in combination with include files, macros, generics.
>
> Why?  You only apply the extra lookaheads where needed (code that
> could be ambiguous). All other parts of the code will be parsed as
> normal - as it is done now.
>
> So far I know of only two examples where extra lookaheads need to be used.
>  * wiki example where 'default' is used
>  * my example to fix the inconsistent syntax for hint directives (deprecated).
>
> --
> Regards,
>  - Graeme -
>
>
> ___
> fpGUI - a cross-platform Free Pascal GUI toolkit
> http://opensoft.homeip.net/fpgui/
> ___
> fpc-pascal maillist  -  fpc-pas...@lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>



-- 
Aleksa Todorovic - Lead Programmer
Eipix Entertainment
www eipix com
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] deprecated syntax is inconsistent.

2010-04-29 Thread Flávio Etrusco
On Thu, Apr 29, 2010 at 6:44 AM, Michael Van Canneyt
 wrote:
> On Thu, 29 Apr 2010, Graeme Geldenhuys wrote:
>> Jonas Maebe het geskryf:
(...)
>
> Jonas tried to explain that this is not possible.
>
> Consider the following - what  you propose - statements:
>
> Var
>  A : Integer;
>  deprecated : Boolean;
>
> The compiler cannot decide whether the 'deprecated' is a modifier or the
> name of a variable. Both are possible (deprecated is NOT a keyword) and
> valid.
>
> With the current syntax:
>
> Var
>  A : Integer deprecated;
>  Deprecated : Boolean;
>
> The compiler knows in both cases what is meant.
>
> The matter could be resolved by making 'deprecated' and all other modifiers
> into keywords, but that would be a major backwards incompatibility.
>
>
> Michael.

But I firmly believe that the breakage would be really really minimal.
FPC had made backwards incompatible changes before... Please? ;)

Best regards,
Flávio
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] deprecated syntax is inconsistent.

2010-04-29 Thread Marco van de Voort
In our previous episode, Graeme Geldenhuys said:
> > Language: that parsing is possible using a single lookahead token.
> > (it makes for faster parsing)
> 
> And because of that age old statement, we now have to live with
> inconsistent syntax.

And get better quality errormessages in return. Way more important IMHO.

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] deprecated syntax is inconsistent.

2010-04-29 Thread Matt Emson

Graeme Geldenhuys wrote:

On 29 April 2010 14:51, Florian Klaempfl  wrote:
  

Having a bigger lookahead makes a lot more things far more complex
epecially in combination with include files, macros, generics.



Why?  You only apply the extra lookaheads where needed (code that
could be ambiguous). All other parts of the code will be parsed as
normal - as it is done now.

So far I know of only two examples where extra lookaheads need to be used.
  * wiki example where 'default' is used
  * my example to fix the inconsistent syntax for hint directives (deprecated).
  


Let's be honest here - maybe you should submit a patch? It might get 
accepted if it passes testing. If you're not willing or able to do so, 
it doesn't sound like the key FPC developers are going to do the changes 
for you ;-) It's a really, really small and insignificant syntax 
annonoly. There are far worse ones in Pascal - I point you towards 
"repeat... until" in The TP/Delphi/Borland style Pascal dialects.



___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] deprecated syntax is inconsistent.

2010-04-29 Thread Graeme Geldenhuys
Marco van de Voort het geskryf:
> 
> And get better quality errormessages in return. Way more important IMHO.

And we just ignore the docs that can't describe the syntax?  :-)



Regards,
  - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://opensoft.homeip.net/fpgui/

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] deprecated syntax is inconsistent.

2010-04-29 Thread Marco van de Voort
In our previous episode, Graeme Geldenhuys said:
> > And get better quality errormessages in return. Way more important IMHO.
> 
> And we just ignore the docs that can't describe the syntax?  :-)

If you think there is a problem in the latex package, feel free to
fix/enhance it. 
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


"strict", another oddity ? [Re: [fpc-pascal] deprecated syntax is inconsistent.]

2010-04-29 Thread Martin
While I am not particularly leaning to either side on the "deprecated" 
discussion, I found another "oddity" due to the single lookahead scenario


"strict" is allowed as identifier. the following does compile
var
  strict: Integer;

BUT, because now e can have "strict private"; the following does NOT 
compile:

type
  TForm1 = class(TForm)
  private
strict: Integer;

Even though I would think it to be correct code? (There probably exists 
a wiki explaining it?)


Martin

On 29/04/2010 13:35, ik wrote:
On Thu, Apr 29, 2010 at 13:39, Jonas Maebe > wrote:



On 29 Apr 2010, at 12:00, Graeme Geldenhuys wrote:

Michael Van Canneyt het geskryf:

Consider the following - what  you propose - statements:


Var
 A : Integer;
 deprecated : Boolean;

The compiler cannot decide whether the 'deprecated' is a
modifier or the


Yes it can, because in your example 'deprecated' is followed
by a colon and
a type.

Var
  A : Integer; deprecated;

This is *not* ambiguous at all,


It is ambiguous to the compiler, as is explained in one of the
links I posted previously:

http://wiki.freepascal.org/User_Changes_2.4.0#Order_of_field_and_method.2Fproperty_declarations

"The above code was ambiguous to the compiler, because when it
finished parsing the property, it could not decide based on seeing
the default token whether this meant that the property was a
default property, or whether a field coming after the property was
called "default". It did find this out after it had parsed the
default token (because the next token was a ":" rather than a
";"), but by then it was too late."

The compiler uses only a single lookahead token, while
disambiguating your example would require two.




___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

[fpc-pascal] Is there a StringRefCount() equivalence?

2010-04-29 Thread Bihar Anwar
Delphi has StringRefCount() function (I'm not aware since what version it was 
introduced). I just curious, is there a function equivalent to it in FPC? 
Currently, I just steal a portion of code from System unit:

type
  PAnsiRec = ^TAnsiRec;
  TAnsiRec = packed record
Ref,
Len   : SizeInt;
First : Char;
  end;

const
  FirstOff   = SizeOf(TAnsiRec) - 1;

var
  S: ansistring;
  RefCount: SizeInt;

RefCount := PAnsiRec(S - FirstOff)^.Ref



  
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Is there a StringRefCount() equivalence?

2010-04-29 Thread Anton Tichawa
On Thu, 2010-04-29 at 10:30 -0700, Bihar Anwar wrote:
> Delphi has StringRefCount() function (I'm not aware since what version it was 
> introduced). I just curious, is there a function equivalent to it in FPC? 
> Currently, I just steal a portion of code from System unit:
> 
> type
>   PAnsiRec = ^TAnsiRec;
>   TAnsiRec = packed record
> Ref,
> Len   : SizeInt;
> First : Char;
>   end;
> 
> const
>   FirstOff   = SizeOf(TAnsiRec) - 1;

shouldn't that read e.g.


> const
>   FirstOff   = SizeOf(TAnsiRec) - SizeOf(Char);
> 

SCNR

Anton


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] deprecated syntax is inconsistent.

2010-04-29 Thread Graeme Geldenhuys
On 29 April 2010 17:23, Marco van de Voort  wrote:
>
> If you think there is a problem in the latex package, feel free to
> fix/enhance it.

Its got nothing to do with the latex package. Trying to describe the
inconsistent syntax of Hint Directives in a syntax diagram (like used
in the FPC Language Reference doc) just seems impossible. From what I
can conclude, you need to have something like a "if xxx then yyy"
meaning you will have a couple of diagrams say the syntax is like XXX,
BUT it is also like YYY, BUT you also get ZZZ... bla, bla. Do you guys
not see the issue?

So I guess the bottom line is, if you guys are given a patch that
*fixes* the syntax for ObjFPC mode, would such a patch be accepted?

-- 
Regards,
  - Graeme -


___
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] deprecated syntax is inconsistent.

2010-04-29 Thread Vincent Snijders

Graeme Geldenhuys schreef:

On 29 April 2010 17:23, Marco van de Voort  wrote:
Its got nothing to do with the latex package. Trying to describe the
inconsistent syntax of Hint Directives in a syntax diagram (like used
in the FPC Language Reference doc) just seems impossible. From what I
can conclude, you need to have something like a "if xxx then yyy"
meaning you will have a couple of diagrams say the syntax is like XXX,
BUT it is also like YYY, BUT you also get ZZZ... bla, bla. Do you guys
not see the issue?


I don't see the issue, it gets a bit more complicated, but not 
impossible. I am just bad in ascii graphics, but I can imagine how it 
looks like.


Vincent
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal



Re: [fpc-pascal] deprecated syntax is inconsistent.

2010-04-29 Thread Graeme Geldenhuys
On 29 April 2010 21:57, Vincent Snijders  wrote:
>
> I don't see the issue, it gets a bit more complicated, but not impossible. I
> am just bad in ascii graphics, but I can imagine how it looks like.


I'm sure Michael will welcome your patch, and I'll be eager to see it too.  ;-)


-- 
Regards,
  - Graeme -


___
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] deprecated syntax is inconsistent.

2010-04-29 Thread Vincent Snijders

Graeme Geldenhuys schreef:

On 29 April 2010 21:57, Vincent Snijders  wrote:

I don't see the issue, it gets a bit more complicated, but not impossible. I
am just bad in ascii graphics, but I can imagine how it looks like.



I'm sure Michael will welcome your patch, and I'll be eager to see it too.  ;-)




I don't need the patch, the text and the examples were good enough for me.

Vincent
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] Two questions Widechar

2010-04-29 Thread Luis Fernando Del Aguila Mejía
For this program :  http://www.conoce3000.com/prueba.pp

Why not show the Euro?. The shell is in Win-1252 and the source code on Win-1252
Does WideChar only used with Unicode BMP Plane 0 ó UCS-4?

thanks.___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

[fpc-pascal] Re: What project management tool does FPC developers use?

2010-04-29 Thread Frank Church
I think it will be a good idea.

I have been experimenting with Redmine, and though I haven't used it
intensively, it makes me see how useful a project management tool can
be in a project with a lot of contributors and interested users.

Perhaps some of the major developers could try something like that on
a personal basis.


On 27 April 2010 17:05, Frank Church  wrote:
> What project management tool does FPC and Lazarus developers use? I
> mean besides mantis for bug tracking?
> I am thinking along the lines of JIRA, Redmine, Fogbugz etc.
>
> It is hard to get a view of what things are progressing or what needs doing,
>
> --
> Frank Church
>
> ===
> http://devblog.brahmancreations.com
>



-- 
Frank Church

===
http://devblog.brahmancreations.com
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Is there a StringRefCount() equivalence?

2010-04-29 Thread Bihar Anwar
Thanks Anton for your suggestion, I will apply it. I hope FPC developers will 
include StringRefCount() to the RTL.

By the way, how do I call internal compiler functions directly (maybe using a 
tricky way) such as  system.fpc_ansistr_incr_ref()  and  
system.fpc_ansistr_decr_ref?
I couldn't call those kind of functions from my program, I guest it is caused 
by compilerproc  definition.



- Original Message 
From: Anton Tichawa 
To: FPC-Pascal users discussions 
Sent: Fri, April 30, 2010 12:44:08 AM
Subject: Re: [fpc-pascal] Is there a StringRefCount() equivalence?

On Thu, 2010-04-29 at 10:30 -0700, Bihar Anwar wrote:
> Delphi has StringRefCount() function (I'm not aware since what version it was 
> introduced). I just curious, is there a function equivalent to it in FPC? 
> Currently, I just steal a portion of code from System unit:
> 
> type
>   PAnsiRec = ^TAnsiRec;
>   TAnsiRec = packed record
> Ref,
> Len   : SizeInt;
> First : Char;
>   end;
> 
> const
>   FirstOff   = SizeOf(TAnsiRec) - 1;

shouldn't that read e.g.


> const
>   FirstOff   = SizeOf(TAnsiRec) - SizeOf(Char);
> 

SCNR

Anton


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal




___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal