Nim is a statically typed compiled systems programming language. It combines successful concepts from mature languages like Python, Ada and Modula. Its design focuses on efficiency, expressiveness, and elegance (in that order of priority).
$ nim -v
Nim Compiler Version 0.20.0 [MacOSX: amd64]
Compiled at 2019-06-06
Copyright (c) 2006-2019 by Andreas Rumpf
git hash: e7471cebae2a404f3e4239f199f5a0c422484aac
active boot switches: -d:release
It was not working in the previous Nim releases too.
Overriding equal function causes incorrect behaviour. Nim compiler translates
!(a == b)
into!a == b
and fails to compile.Example
Current Output
Nim fails to compile and prints the following error.
Expected Output
Possible Solution (not fundamental)
Change the definition of
==
before:
after:
But, it is not not not a fundamental solution .
By the way, if you don't override
==
function, it will print the wrong result (printwrong
).Additional Information
Raw C code (error:14th line):
It was not working in the previous Nim releases too.