Re: Error: invalid indentation

2017-09-25 Thread dataPulverizer
@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

Re: Error: invalid indentation

2017-09-25 Thread mratsim
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

Re: Error: invalid indentation

2017-09-25 Thread LeuGim
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

Re: Error: invalid indentation

2017-09-24 Thread dataPulverizer
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 =

Re: Error: invalid indentation

2017-09-24 Thread xomachine
> 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

Error: invalid indentation

2017-09-24 Thread dataPulverizer
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