[fpc-devel] Proposal: Multiple assignments
Mark Morgan Lloyd
markMLl.fpc-devel at telemetry.co.uk
Fri Aug 6 11:34:18 CEST 2010
Sven Barth wrote:
>> Does _any_ language support that paradigm ?
>
> Python: [...] Java:
Also Perl as (a, b) = (0, 0); I can't remember whether a single value on
the RHS is expanded.
> Although "a=b=c" is more like "assign c to b and assign (the new value
> of) b to a" (but it might work in C as well that way).
Please excuse a comment from a non-developer but I really don't like
this form. I've coded a number of parsers for script languages etc. and
in general provided that you don't allow multiple assignment you can
always work out unambiguously whether you're looking at an assignment or
a test for equality, even without mandating distinct tokens.
I think that the OP needs to research first whether what he is trying to
do could be done by a typed constant assignment, or if there is some way
of building on the associated semantics rather than attempting
ill-considered mutilation of Pascal's underlying syntax.
--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk
[Opinions above are the author's, not those of his employers or colleagues]
More information about the fpc-devel
mailing list