[fpc-devel] Multiple variable initialization
R0b0t1
r030t1 at gmail.com
Sat Mar 24 17:11:11 CET 2018
On Sat, Mar 24, 2018 at 10:53 AM, Jonas Maebe <jonas at freepascal.org> wrote:
> In the end, pretty much every extra language feature makes both the compiler
> and the language more complex. Therefore, I think the question for language
> extensions should never be "is there a good reason not to allow this", but
> "is it really necessary to allow this"? I.e., does it make things much
> easier to read, less error prone to write, and/or increase productivity a
> lot. I don't think the answer is "yes" for any of these questions as far as
> this extension is concerned.
>
For the record the Oberon languages were designed with this philosophy
in mind, and language changes only ever removed functionality (which
did not happen often). Those languages never saw wide adoption but are
very interesting specimens of engineering.
I might agree with an addition similar to Python's tuple unpacking in
assignment, which would allow multiple assignment but require multiple
values:
var
A, B: Integer = 0, 1;
C, D: Integer = 0, 0;
However in some languages this is without good precedent or
justification within the language, and seems like an unnatural
bolted-on feature. Far more important I think is partial
initialization of arrays and records.
Cheers,
R0b0t1
More information about the fpc-devel
mailing list