IMO it's just a system.nim bug caused by misunderstandings about how generic
parameters work.
@mashingan >tldr; if the size of integer is important, always opt to explicit
conversion That seems to be very good advice. I was considering defining my own
operators, but it seems like the first option is the most sensible.
@mratsim I had never actually considered C to be a 'weakly typed' lang
@mashingan >tldr; if the size of integer is important, always opt to explicit
conversion That seems to be very good advice. I was considering defining my own
operators, but it seems like the first option is the most sensible.
@mratsim I had never actually considered C to be a 'weakly typed' lang
I'd also add to @mashingan answer than Nim is a strongly typed language.
Lossless conversion are made explicit for safety reason, we don't want you to
lose information or data by something done under-the-hood and very
time-consuming to debug.
Other strongly typed languages might just plain prev
_tldr; if the size of integer is important, always opt to explicit conversion_
* * *
you can define your own `+` operator for your case
proc `+`(x: uint16, y: uint32): uint32 = x.uint32 + y
Run
But then the definition then become tedious if you have to define another
Now the use of the leaf chain(GETECHAIN)
[https://www.getechain.com/product/leaf-chain-product](https://www.getechain.com/product/leaf-chain-product)/
is still relatively large, and some of the prices of the leaf chain are
relatively high, we all hope to buy a good quality leaf chain. Let's t
@cdome, thanks for the suggestion, but I am working with serial protocols
involving integers of different lengths, so lenientops is not much help. It
works by converting between int and float. @mratsim, thank you for the
explanation. As an experienced user (I've seen your sig many times) can you
Yes - but not at the exact moment when it crash. The CPU spikes almost
immediately and stays up there, the memory has a quick high increase and then
slowly keeps to increase. I don't have any data on the memory usage when it
fails, I will setup a log to check it.
there is module in standard library: lenientops.
it should help
The signature of the proc is
proc `+`[T: SomeInteger](x, y: T): T
Run
T is bound to uint32 in the first case, and we can convert uint16 to uint32
losslessly. In the second case, T is bound to uint16 and we can't convert
uint32 to uint16 losslessly.
Regex
(w*b)*?|(?<=").*(?=")$
Hi, I have a simple question. The Nim manual says that integer operations will
promote the smaller of the two to the larger, but that behavior only seems to
hold true with specific operand order, eg:
`` var arg1:uint32 var arg2:uint16
arg1 = 10 arg2 =12 echo(arg1 + arg2) #works echo(arg2 + arg1
12 matches
Mail list logo