(sorry for the pm, Paul, should have gone to list)

Op 2/20/2019 om 3:32 PM schreef Paul van Helden:
On Wed, Feb 20, 2019 at 3:52 PM Sven Barth via fpc-devel <fpc-devel@lists.freepascal.org <mailto:fpc-devel@lists.freepascal.org>> wrote:


    Pascal is a language where declaration and use of variables is
    separated. It makes it easy to see what variables are declared and
    what type they are. Inline variables mess this up as a variable
    can be declared somewhere inside the code.


Now I'm curious. Can you point me to a resource where Pascal is defined such that the separation of declaration from use is a central tenet? I'm not sure, but I doubt I ever look at the variable declarations to help understand the rest of the code...

I'm not really a Pascal semantics guy, but I'll give it a try:

Pascal is block oriented. At the end of a block is always the opener of a new block (var, type, procedure, begin), encountering these tokens in the wrong are typically a warning that something is wrong.Now what is that marker at the end of an inline variable block ? Afaik there is none. The next can be any statement in any form, and you must disambiguate yourself if a variable declaration is meant or not.

From what I can see Embacadero avoids this by keeping all its examples one line, with the VAR on the same line. But Pascal is not line oriented, so this is also odd.

And keep in mind contrary to C/C++, Pascal is a limited lookahead parser.

So the whole feature reeks of Embacadero's desperation to keep bullet lists for new versions filled to keep people upgrading.

It has nothing to do with language design or better C/C++ syntax (*) or whatever. It is just a quick implementation in the hope to score some points with people that have participated in similar threads in Embarcadero groups. They just did a most minimal quick-and-dirty implementation and tossed on the feature matrix. Please upgrade.


(*) it is strange that people complain about scrolling 1000 lines up to see a declaration, but can effortlessly scan those 1000 lines for possible inline declarations without scrolling up.
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to