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

Martin fpc at mfriebe.de
Fri Aug 6 13:17:58 CEST 2010


On 06/08/2010 11:31, Marco van de Voort wrote:
> In our previous episode, Alexander Klenin said:
>    
>>> punctuation is not even 100% required to understand natural language.
>>>        
>> Correct. That is why reducing it to a required minimum is a good thing.
>>      
> It is not, for the same reason all redundancy is not stripped from natural
> languages either.  It improves reading speed and integrity at only a small
> cost.
>    
Correct they are not: I/you have <> He has. The form of the Verb 
(partly) includes the the subject. And there are reasons for the 
duplicity: recovery if part of the info was lost (bad pronunciation, bad 
handwriting)

In a programming language, a certain duplicity, can help finding errors, 
because the 2nd part (duplicity) is either known or limited to a 
specific set => the compiler can raise an error if it doesn't fit

That is the problem with C: you can have embedded assignments to

   if ((a=a+1)>2) { }
could be
   if ((a+=1) >2) { }

but that may well be a typo, the += may have meant to be a simple +

-------------
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"; }

It's short, isn't it? readable? (and it doesn't work on $a=1, but anyway)

Readability, is also a lot do to with waht you are *used* to read. Once 
you are used to a language,m or to reg-exp, or to whatever, it appears 
easy to read. (and write). But before....

And this thread to me looks just like another: Well I am used to 
language "x" where it looks like that, couldn't we make pascal look the 
same, so it becomes all easier.
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...

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

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

Martin






More information about the fpc-devel mailing list