[mercury-users] Pred defns
lee at cs.mu.OZ.AU
Fri Apr 3 17:43:38 AEST 1998
Peter Schachte wrote:
>On Fri, 3 Apr 1998, Lee Naish wrote:
>> Perhaps Peter would prefer it if postfix operator were used as I
>> suggested (to emphasise the accumulator id rather than the syntactic
>> gloop). There is an added advantage with ':=' - the accumulator id is
>> on the left of the assignment operator, like most languages, eg:
>> map__set(map#, Key1, Value1, map#:=),
>But since map# and := sensible separate things, it would be tempting to
>leave a space between the # and the :=, leading to nothing good.
This argument can be leveled at pretty much every operator with more
than one character. After a few syntax error messages I think most
programmers would get the hang of it.
>when you do an assignment, you'd /need/ to leave a space between the # and
>the := or nothing good would come of it. I find this more worrying.
I'm not sure its good to have a special := construct as well as a
general update accumulator construct - the general purpose one alone is
probably better. I think a := construct will confuse novices a great
deal - they will try to use it to assign to variables (perhaps I'm being
unduely influenced by my current teaching load :-).
More information about the users