the := operator (affectation)
John Vokey
vokey at uleth.ca
Wed Jun 22 23:47:29 EDT 2005
It is fascinating to note that in R (GNU's S) the operator evolved
from ``<-'' to ``='' despite the ambiguity of the latter (R has both
assignment operators (<- and ->), but still simple ``='' won out.
Why? Well, as with the letter ``e'' in English, nobody wants to type
2 characters for the most common operation of assignment; make the
rarer cases clumsy, not the most common; hence ``=='' for ``is equal
to (logical)''. I (tried to, anyway) taught Pascal for years; the
two most common complaints were, in order, the assignment operator
(i.e., ``:= is just stupid''), and ``that stupid semi-colon''. Often
pristine syntax has to take a back-seat to expedience.
OTH, allowing ``a=4'' as a shorthand for ``put 4 into a'' harms
nobody, and meets with the expediency criterion; just don't require
it. Similarly, no Basic compiler or interpreter ever had any problem
discriminating logical statements from assignments, nor did
programmers; it was a false purity that Pascal was promoting.
Indeed, we exploited it: a=b*(c=2)+d*(c<>2), which to any Basic
programmer (except those in which false meant -1, but simple
accommodations in code fixed that), transparently means: a is
assigned the value of b given c has the value of 2, otherwise, a is
assigned the value of d.
On 22-Jun-05, at 4:51 PM, use-revolution-request at lists.runrev.com wrote:
> Yep
>
> On Jun 22, 2005, at 8:01 AM, Jon wrote:
>
>
>>
>>
>> Dan Shafer wrote:
>>
>>
>>
>>> (I always found the whole ==, +=, :=, == syntax mess pretty ugly.
>>> I love the elegance of put 32 into x.)
>>>
>>>
>>
>>
>> Elegance, verbosity. Poe-tay-toe, poe-tah-toe...
>
- JRV
--
There are 10 kinds of people: those who understand binary, and those
who don't
More information about the use-livecode
mailing list