[fpc-devel] Proposal: Enhanced replacement for assignment operators

Alexander Klenin klenin at gmail.com
Fri Aug 6 04:59:35 CEST 2010


On Fri, Aug 6, 2010 at 07:23, Florian Klämpfl <florian at freepascal.org> wrote:
> Am 05.08.2010 22:19, schrieb _-jane-_ at web.de:
>> Hello everybody,
>>
>> I would like to propose an enhanced replacement for the special assignment operators += -= *= and /= :
>> More pascal-like would be constructs of the form "operator :=" such as
>>   a + := 1;

FPC already supports this (and I, for example, often use it).
Syntax is a += 1; however

>>   a << := 1;

"<<" is spelled "shl" in Pascal.

>>   a div := 3;
>>   a or := b;
>>   a xor := 3;

Now, this is IMHO a good point -- at least div= and mod=
operators should definitely be added to a set of "C-like" operators.
or= and= xor= would be good too, although I can see
some potential confusion regarding short-circuit behavior.

>> Together with my prior proposal of multiple assignments there could be stuff like below as well:
>>   a,b + := c+d;
>>   a,b << := 1;
>
> And you think this is simply to read?

Heh, not even Perl 6 has these, and Perl 6 has *many* operators ;-)

-- 
Alexander S. Klenin



More information about the fpc-devel mailing list