[fpc-devel] Proposal: Multiple assignments
Mark Morgan Lloyd
markMLl.fpc-devel at telemetry.co.uk
Sat Aug 7 17:23:21 CEST 2010
Sven Barth wrote:
> Well... in C a test for equality is always "==". So, when reading it
> (and not having read a Pascal code some minutes before :P ) one should
> recognize without problems whether it's an assignment or a comparison
> expression (it's another story that many people - including me - don't
> recognize it that easily ^^)
As in the classic patch
+ if ((options == (__WCLONE|__WALL)) && (current->uid = 0))
+ retval = -EINVAL;
which somebody tried to slip into the Linux kernel.
I think though that you only need distinct tokens (i.e. == vs = in the
case of C) if the language includes multiple assignments. Or possibly I
should say indeterminate assignments, lest there are cases where being
able to discard a function's return value introduces ambiguity.
So some variant of OP's suggestion such as (a, b):= 0 does have
something going for it, at least when compared with a:= b:= 0. In fact-
although I don't know whether this is parseable- (a, b):= X with
implicit duplication as compared with (a, b):= (X, Y) where both sides
have to match, since <wild_speculation> this is beginning to look like
something that could be parallelised </>.
--
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