3 ms·
> I've never been able to construct a series of tokens in > which the meaning changes based on which of those you > use, and it's legal either way. Her
by matthiasl 12y ago
> I've never been able to construct a series of tokens in
> which the meaning changes based on which of those you
> use, and it's legal either way.
Here's a series of tokens where switching comma to full stop means different things and both are legal:
1> 1,0.
0
2> 1.0.
1.0
In the first line, the comma is an expression separator. Attempting to use a full stop instead results in a floating point number.
f(X, Y) when X, Y -> ok.
g(X, Y) when X; Y -> ok.
In this case, the guard in f is turned into a guard sequence by switching a comma to a semicolon. Both are legal.
Matt
- jerf 12y agoNeither of those are valid examples of what I meant. In the first, the . is not the function terminator, it's the floating point separator. Same ASCII character, different semantic token. In the second, the comma is not the statement separator, it's the value separator. Again, same ASCII character, different semantic token. The question is, can you produce a situation in which ; . , are interchangable and valid in their capacity as statement separators. My compliments for trying though, as I'm aware this smells like goalpost hiking and I do want to be complimentary about what you did. If you read my post again, though, I think it will become clear that this is what I meant all along, but I agree this superficially looks like I'm trying to cheat.