@LeuGim - thanks for the clarification
@mratsim I didn't know about SomeReal thanks for pointing that out.
> By the way, I don't really understand your need but you can usually go very
> far in Nim with just generics and overloading without to implement class-like
> types.
>
> If you need runt
Nitpicking but just use the
[SomeReal](https://nim-lang.org/docs/system.html#SomeReal) typeclass instead of
this line:
floatingPoint = float | float64 | float32
By the way, I don't really understand your need but you can usually go very far
in Nim with just generics and over
Yes, `object` is a value, `ptr object` is a non-garbage-collected pointer to an
object, `ref object` is a garbage-collected pointer to an object, `object of
...` is the way to inherit, to be combined with any of the previous, and after
any of that a list of fields may go.
`RootObj` is not smth
Many thanks! Looks like I didn't read the manual properly, I ended up thinking
that ref Parent was how inheritance works. Just for confirmation:
type
# This is equivalent to a struct
Object1 = object
# This is a reference type to the "struct" Object1
Object2 =
> Child1[T: FloatingPoint] = ref Parent1
It means that Child1 is just a reference to Parent1, so no additional fields
allowed after such a declaration. I assume you intended to write something like
this
type
floatingPoint = float | float64 | float32
Parent1Obj = object
Brand new to Nim, trying out parametric type with hierarchy, got stung with an
indentation error for the last two lines that I can't figure out why
type
floatingPoint = float | float64 | float32
Parent1 = ref object
Parent2 = ref Parent1
Parent3 = ref Parent1