Lukas Renggli wrote:
Now could not we have 3? 3 do 1 (ie no preference) but transform the code from _ into := automatically. It would be really great in fact
That would be the magic solution :-)
The problem is that it would not be clear how to parse a_1. Is it the assignment of 1 to a or the access of the variable a_1?
I don't like the proposal of requiring a delimiter before and after an underscore assignment: (1) there is existing code where this is not the case,
A small minority of code, surely?
(2) it complicates the scanning significantly, the same token represents different things depending on context and an extended lookahead is required to parse it,
I'm afraid I'm not seeing this point. From a brief look at the scanner, it appears that allowing := assignment did complicate the scanner somewhat, but that allowing _ to mean assignment should be similar complexity and still only require one-char lookahead. But perhaps I'm missing something.
and (3) it allows that people continue to use crappy underscore assignments, there will be a mess forever.
I can't (and don't want to) argue with that :-) I'll gladly accept "we don't want to allow underscore assignment" as an argument, I'm not so sure about the "it's hard" argument. Regards, -Martin