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

Alexander Klenin klenin at gmail.com
Fri Aug 6 16:15:26 CEST 2010


On Fri, Aug 6, 2010 at 22:17, Martin <fpc at mfriebe.de> wrote:
> -------------
> Readability is not equal to the sortest form of expressing something, in
> fact, the shortest form often lacks readability => hence many people dislike
> reg expression (which infact can be wonderfully short.
> in perl:
> $a := 11;
> if ( ('x' x $a) =~ /^(..+)\1+$/ ) { print "$a is prime"; }

Not quite,

$a = 11;
print "$a is prime" if ('x' x $a) !~ /^(..+)\1+$/;

Is correct (and slightly more readable) Perl.
But the point is -- yes, this code is, aside from the horrible ineffectiveness,
this is perfectly good code, easily understandable by anybody familiar
with the language. That's not Perl Golf or anything like that.

> And imho the answer is: Why make pascal look more like every other language.
> If that's what is wanted, then let's create a new language, taking the best
> out of all other languages...

On the one hand, that's reductio ad absurdum.
On the other, is not this exactly how Pascal developed in the last decade?

> That "+=" is (sometimes) called "c style assignment" already says it all.

Actually FPC is the only place I know which calls them that.

> And, since I also refuse to learn from the faults of others, some sarcasm in
> the end:
> begin end is awfull amount of typing => can we replace it with something
> shorter? "{" is unfortunately taken, but why need an actual char => just
> identify a block, by indenting each line of the block, much less clutter,
> all the extra begin/end can go....

Actually, your sarcasm misfires in that case ;-)
I do think that begin/end is an awful amount of visual clutter,
and that Modula solution is a better one.
Unfortunately, this change is totally out of question because
it will break literally all the existing code.

-- 
Alexander S. Klenin



More information about the fpc-devel mailing list