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

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


On Wed, Feb 20, 2019 at 8:07 AM Nikolai Zhubr <n-a-zhubr at yandex.ru> wrote:
>
> Hi all,
>
> 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)

The problem is that you want to see an "i" variable that is index of the loop?
The same construction was good for years, but now, as other languages
has that feature, Object Pascal is obsolete and should add all that
"new features"?

If a function has 1000 lines is a problem in the design, not in the
language - in fact, doesn't matter the language in that case.

> 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).

Again, if you has many variables into a method, is a problem in the
design. You must split the code in other methods.
If you have blank lines inside a method, this is another case to split...

regards,
Marcos Douglas



More information about the fpc-devel mailing list