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

_-jane-_ at web.de _-jane-_ at web.de
Thu Aug 5 23:09:03 CEST 2010


Hello Florian!

>> 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;
>> a div := 3;
>> a or := b;
>> a xor := 3;
>> a << := 1;

>> 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?

The C-operators can be thought of a composition of a binary operator (+,-,*,/) and the assignment operator, so my solution should be the natural pendant in Pascal.

I cannot think of a more readable and more Pascal-like solution. For me the C-like pendants are even less readable and appear to me as a too limited quick hack. The Delphi-style replacements such as inc/dec/include/exclude are even less usable since both assignment and the operation itself is no longer visible and to wordy. A new pseudo-proc for every such operator is for sure not the best idea.

There are some reasons for my solution:
* You still see that there is an assignment
* No new operators: just combinations of an existing a binary operator and :=
* Extendability: Any suitable (existing) binary operator can be used, even worded ones

BTW: I wrote << by mistake; it should have been shl.

Best regards
Jasper
___________________________________________________________
GRATIS für alle WEB.DE Nutzer: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://movieflat.web.de



More information about the fpc-devel mailing list