> Latest Nim is not that dumb for literals:
This is not new. NIm has been able to handle these implicit conversions since
pretty much forever (I checked 0.11.0 to be sure).
Where problems come into play are constants in complex types, such as ranges,
tuples, and arrays. For example, the
> var x: uint16 = 5.uint16
var x = 5'u16
> Latest Nim is not that dumb for literals: _(example)_ Works fine, even the x
> / 2!
Excellent news, thank you.
> The fact that Nim does not do that many automatic type conversions is good
> for safety and performance ... And as Dom said, lenientOps exists now, but I
> think I will generally
> Yes, sometimes Nim is (still) a bit dumb. When I for example assign 5 to a
> uint16 var it feels a bit strange to still have to write 5.uint16.
Latest Nim is not that dumb for literals:
var a: uint16
a = 5
echo a
var x: float
x = 10
x = x / 2
echo x
> 1) When you work on very platform dependent code, you have to manually add a
> bunch of constants and so on.
My current solution: a single -d:[platform] switch and an include file with
some `when` logic. Probably by far not the smartest way but simple and working
2) Too picky with variables
> 2) Too picky with variables types. I ended up casting so much in my code (or
> pending my values with ".intx" it is not even funny anymore. You type a lot.
I am also bitten by this far too much. There is a certain trade-off to be made
here though between safety and convenience.
I think the
I will tomorrow. But it will be and excerpt because the library cannot be
published..
If you type a lot, then you need Macros and Templates.
You checked `byte` type?, up to 255, can be useful.
Check the docs about defining compile variables, like `-d:somethingCustom` then
`when defined(somethingCustom): # code here`.
Please provide samples of code for 2 and 3
Hi,
Nim is a great tool.
but:
1) When you work on very platform dependent code, you have to manually add a
bunch of constants and so on. Maybe the situation could be improved by using
commands of the like "gcc -v -x c -E /dev/null" (or similar with other major
compilers) to parse the default
10 matches
Mail list logo