I was looking at the COM module of Winim and came across what looks to be (to
my newbie eye) procedure overloading by return type:
converter variantConverter*(x: variant): string = fromVariant[string](x)
converter variantConverter*(x: variant): cstring = fromVariant[cstring](x)
I don't think is possible for floating point numbers, for example
implementation of exp(float32) and exp(float64) is widely different and
float32(exp(float64)) is not equal to exp(float32).
And this property holds for most floating point functions: log, sin, cos, sihn,
erfc and many others.
Yo
Goran, thank you very much! Your code perfectly fits with what I needed and
comments immediately answers all the questions running in head. Btw, I was
pleased to read your article "Nim and OO" some time ago and discover another
Smalltalk fan. I myself fell in love with Smalltalk from the first s
**Stefan:** _I still hope that we get an answer of a core dev. That use case is
very common in OO languages. So I am asking myself already for a long time how
to handle it, maybe I have already asked others, I can not really remember. I
have for example a lot of legacy Ruby code that extends sta
I'm honestly not following the reasoning here. Unlike C, Nim by default does
not expose the members of a record type. So, in order to have information
hiding, I would simply not make them externally visible. You can't do that in
C, because as soon as you include a typedef for a struct there, you
"But I agree, we need to do something about it."
This still bothers me, since the compiler has a constant for either 32 or 64
bit ints, could that not be user defined for ints and floats?
Here are the reasons it bothers me:
* All C/C++ libraries expect 32 bits
* All GPUs expect 32 bits
*
I come from a different school of languages so I would perhaps do something
like the following:
warehouse.nim:
type
# We want everything on the shelf to be a Box
Box* = ref object of RootObj
Warehouse* = ref object
shelf: seq[Box] # We do not use *
I have still some trouble understanding your intended use case. Nim is a high
level language, so low level stuff like pointers, cast, addr, GC_ref and
GC_unref is generally only necessary if interfacing with low level C libraries,
when at all. (OK, it may be also needed when you write real low l
The question is not about interfacing with other languages, but exceptionally
about interfacing of Nim modules with each other. The C language allows to hide
internals of a type declaration but still have type checking using just
"half-anonymous" `struct BoxOfStuff *` pointer. I want this functi