Re: [fpc-pascal] deprecated syntax is inconsistent.
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.
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.
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.
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.
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.
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.
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.
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.
On 29 April 2010 12:39, Jonas Maebe jonas.ma...@elis.ugent.be 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.
On Thu, 29 Apr 2010, Graeme Geldenhuys wrote: On 29 April 2010 12:39, Jonas Maebe jonas.ma...@elis.ugent.be 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.
Michael Van Canneyt schrieb: On Thu, 29 Apr 2010, Graeme Geldenhuys wrote: On 29 April 2010 12:39, Jonas Maebe jonas.ma...@elis.ugent.be 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.
On 29 April 2010 14:51, Florian Klaempfl flor...@freepascal.org 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.
On 29 April 2010 14:48, Michael Van Canneyt mich...@freepascal.org 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.
Graeme Geldenhuys schrieb: On 29 April 2010 14:51, Florian Klaempfl flor...@freepascal.org 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.
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 graemeg.li...@gmail.com wrote: On 29 April 2010 14:51, Florian Klaempfl flor...@freepascal.org 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.
On Thu, Apr 29, 2010 at 6:44 AM, Michael Van Canneyt mich...@freepascal.org 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.
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.
Graeme Geldenhuys wrote: On 29 April 2010 14:51, Florian Klaempfl flor...@freepascal.org 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.
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.
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
Re: [fpc-pascal] deprecated syntax is inconsistent.
On 29 April 2010 17:23, Marco van de Voort mar...@stack.nl 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.
Graeme Geldenhuys schreef: On 29 April 2010 17:23, Marco van de Voort mar...@stack.nl 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.
On 29 April 2010 21:57, Vincent Snijders vsnijd...@vodafonevast.nl 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.
Graeme Geldenhuys schreef: On 29 April 2010 21:57, Vincent Snijders vsnijd...@vodafonevast.nl 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