[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: The meaning of 'sugar' [Forked from Re: Why do we have ipairs?]
- From: Francisco Olarte <folarte@...>
- Date: Wed, 11 Jun 2014 16:56:34 +0200
Hi:
On Wed, Jun 11, 2014 at 4:09 PM, Andrew Starks <andrew.starks@trms.com> wrote:
> The *expressive power* portion of the definition is the part that I was
> reaching for. For example, the intent of "i = i +1" could not be clearer.
> "++i" is shorter and sweeter for the programmer, but it is not clearer and
> it is not more expressive.
I do not think you've picked a very good example. Many people, me
among them, parse '++i' as 'increment i' in one simple pass, and when
you have something like
++a_very_long_variable_name_becuase_it_is_a_global, it's much clearer.
Anecdothically I've also found much easier to teach begining
programmers the meaning of '++i' than fo i=i+1, they always say, no,
i+1 is greater, until they learn to parse it as calculate thing on the
right, store it on the left.
Francisco Olarte.