sdl2_nim
sdl2_nim copied to clipboard
Exported converters cause havoc.
I just spent 10-20 minutes to hunt down why I could not echo a byte
, which is cause of https://github.com/Vladar4/sdl2_nim/blob/43bbdb99e01aa3d2117fc536dd6b0ed3280791a9/sdl2_nim/private/stdinc.nim#L87. This should be behind a flag or removed in my view. To see the fun error message you get due to it consider the following.
converter toInt*(x: uint8): int = int(x)
echo 10u8
``
bef9a610a6bf53fba4cca231631603a3679b5b98 should help. Please check and let me know.
That will not resolve the issue as converters bubble up. For example the following still errors.
# Module c
converter toInt*(x: uint8): int = int(x)
proc `$`*(x: uint8): string {.raises: [].} =
result.addInt(int(x))
# Module b
import c
# Module a
import b
echo 10u8
looks to me like a Nim bug that needs a workaround.