Thomas Hallgren [EMAIL PROTECTED] writes:
In the syntax for labeled fields (records) the symbol - is chosen
as the operator used to associate a label with a value in
constructions and patterns:
[...]
According to a committee member, there were no convincing reasons
why - was chosen. Other symbols, like = and := were also considered.
I support Thomas Hallgen's suggestion that `=' be used instead.
Another reason, in addition to the two he mentioned, is that the `-'
symbol is very unintuitive when used for pattern matching, because the
arrow is in the *opposite* direction to the data-flow. I find this
very confusing.
Indeed, a couple of reasons I find convincing myself:
1 - SML uses '=' too, therefore it is one less problem for people
moving to/from SML/Haskell.
2 - The '-' notation always reminds me of list comprehensions,
e.g. at first sight if I see an expression like
R{v - [1..10]}
I could think v is an integer (taken from [1..10]) when it is actually a list.
the following expression is also confusing:
[R{v - [1..x]} | x - [1..10]]
(defines a list of records)
An expression using records on the rhs of the '|' should be even more interesting
(and useful for obfuscated Haskell competitions).
The same applies for records with fields defined with list comprehensions.
Andre.
Andre SantosDepartamento de Informatica
e-mail: [EMAIL PROTECTED] Universidade Federal de Pernambuco
http://www.di.ufpe.br/~alms CP 7851, CEP 50732-970, Recife PE Brazil