Open valashko opened 4 years ago
The code is invalid, there exists no double assignment in nim.
Well, I am quite surprised that a = b
is not an l-value like in every other programming language. At the very least I would expect a proper error message.
Well, I am quite surprised that a = b is not an l-value like in every other programming language.
Python lacks it too and is a very successful programming language.
Well, I am quite surprised that a = b is not an l-value like in every other programming language.
There are quite a few languages where it is not an l-value.
At the very least I would expect a proper error message.
That's a very legitimate complaint. And if it's changed to
proc stateToString(state: State): string =
var dummy: string
result = dummy = "one"
then the error message is "tst.nim(7, 18) Error: invalid indentation" which is Nim's favorite obscure fallback error message. At least it gives the correct column number for the error.
@jibal your code is invalid anyway, in Nim assignments don't return a value, they're statements, so you can't do "double assignment" like that
@jibal your code is invalid anyway, in Nim assignments don't return a value, they're statements, so you can't do "double assignment" like that
I'm well aware that the code is invalid (which was already discussed above), but that has absolutely nothing to do with the point, which is about the error message.
@jibal well I know, that's why I marked my message as off-topic so you wouldn't reply to it, but you still did :)
@jibal well I know, that's why I marked my message as off-topic so you wouldn't reply to it, but you still did :)
Better to delete it, since it's completely irrelevant and pointless. It doesn't matter how you marked it; that you posted it resulted in sending an annoying message to my mailbox.
Presence of double assignment inside the
case
statement incorrectly triggers compiler error not all cases are covered.Example
Current Output
Expected Output
Additional Information