[fpc-devel] "Blank slate" next version of FPC

Marcos Douglas B. Santos md at delfire.net
Wed Feb 20 13:47:20 CET 2019

On Wed, Feb 20, 2019 at 8:32 AM Henry Vermaak <henry.vermaak at gmail.com> wrote:
> On Wed, Feb 20, 2019 at 02:26:20PM +0300, Nikolai Zhubr wrote:
> > 20.02.2019 13:21, Sven Barth via fpc-devel:
> > [...]
> > >And we don't agree here. For us inline variables is one of the most
> > >horrid if not *the* most horrid thing Embarcadero could have done to
> > >Object Pascal.
> >
> > Could you elaborate a bit about it?
> > While I'm not really sure what they have done exactly (not using latest
> > Delphi and probably not going to), I've somehow got very used to (and
> > confortable with) Java's inline declarations, especially "for (int i = 0;
> > ....)" and similar constructs, and now I find myself doing this way all the
> > time, because:
> >
> > 1. it makes it easier to see the whole picture just looking at the loop
> > body, no need to scroll up; (The loop body might be just 10 lines of code,
> > whereas the whole containing function sometimes has 1000s)
> >
> > 2. it isoltates the scope of such variable(s), therefore preventing some
> > sorts of accidental misuse outside of e.g. the containing loop (which still
> > do happen to me ocasionally in Pascal).
> I've already tried to make these points, nobody seems to buy it.  IIRC
> Michael (vC) said that functions shouldn't be that long, so then it's
> not a problem (perhaps his world is perfect, but mine certainly isn't).

Anyone can split a function in many others. It's not so difficult and,
actually, it should be done.

> I'm mostly more interested in limiting the scope to prevent accidental
> use, like you.  It can also offer more fine grained control of where
> managed variables get freed.

Try to see restrictions as a good thing.
In this case, which Pascal doesn't allow to declare inline variables,
you must split big functions, which has many local variables, in
others to have a better understanding of the algorithm. At the end,
you might have a better design and reuse of the code. Everybody wins:
you, your code, Pascal team - as they don't need to change the
compiler - and Niklaus Wirth might not throw a curse in us.

Marcos Douglas

More information about the fpc-devel mailing list