Hi to everybody,
I just noticed that the backward incompatibility introduced by the fix for bug #3096 (https://github.com/nim-lang/Nim/issues/3096) is not explicitly listed in the announcement for the release of Nim 0.12.0 (http://nim-lang.org/news.html#Z2015-10-27-version-0-12-0-released).
As described in the bugpage, such a code compiled fine under Nim 0.11.x but makes Nim 0.12.0 complain (Error: low(kind) must be 0 for discriminant in line 12):
type
DataType* {. pure .} = enum
Char = 1,
Int8 = 2,
Int16 = 3,
Int32 = 4,
Int64 = 5,
Float32 = 6,
Float64 = 7
DataSeq* {. pure .} = object
case kind* : DataType
of DataType.Char: charSeq* : seq[char]
of DataType.Int8: int8Seq* : seq[int8]
of DataType.Int16: int16Seq* : seq[int16]
of DataType.Int32: int32Seq* : seq[int32]
of DataType.Int64: int64Seq* : seq[int64]
of DataType.Float32: float32Seq* : seq[float32]
of DataType.Float64: float64Seq* : seq[float64]
length* : int
I'm filing this here because I am not sure if there is a proper place to report bugs for the Nim site.
"I am not sure if there is a proper place to report bugs for the Nim site."
Araq wants all potential issues posted on github. So open a new issue https://github.com/nim-lang/Nim/issues
Afaik Araq did already tell that you need to add the 0 in the enum. See https://github.com/nim-lang/Nim/issues/3096#issuecomment-141926440
I thought that the OP request is to update the documentation for the changes listing in release 0.12.0 on the website.
Just my thought :)
EDIT: Hmm... actually my bad (in a way). The website text is indeed part of the Nim compiler repository. Such that one could even create a PR to add the missing info to the changes list.
OderWat: Afaik Araq did already tell that you need to add the 0 in the enum.
Sure, I fixed that code a long time ago. It turned to be harder than I thought. DataSeq variables are meant to be read/written in binary streams, and one byte containing the kind value must be prepended to the bytes encoding the sequence itself. The file format requires to have 1 for Char, 2 for Int8, etc.
I first added a None = 0 line to DataType, but the compiler started complaining that a number of case statements involving DataType were not exhaustive. I discarded None and instead removed the numbers in DataType, allowing Nim to pick whatever values it wanted. However, this was not enough for my code to work. With Nim 0.11 I just read/wrote the value of the kind member in the binary stream, but to make the code compilable under Nim 0.12 I had to manually search all the instances in the code where kind was blindly used and wrap it into something like binary_code(myDataSeq.kind). I spent a couple of hours to fix this and re-test everything.
OderWat: I thought that the OP request is to update the documentation for the changes listing in release 0.12.0 on the website.
That was exactly my point. I do no longer use that code, as in the meantime I decided to rewrite it from scratch in C+Python. But when I first got the error low(kind) must be 0 for discriminant after having updated Nim, I had troubles finding what caused the incompatibility. The name of that commit ("Fix #3096") did not help at all.
Given the problems this change caused to my code, I felt it was important to underline the issue in the release notes.