Re: Some OOP problems

2018-09-24 Thread Stefan_Salewski
Yes, without var it works fine. For a init proc using var feels natural for me, indeed I had the wrong feeling that it may be even necessary to modify member fields. But var is only needed to modify the ref itself, which is not desired of course. Funny typo in my code: echo "A dog

Re: Some OOP problems

2018-09-24 Thread lscrd
I have already encountered this error. As far as I remember, it occurs when you use "var" in a proc whereas the type is a "ref object". If you change this in your example, the error disappears. type Animal* = ref object of RootObj age*: int proc init(x: Animal

Some OOP problems

2018-09-24 Thread Stefan_Salewski
Yesterday I was playing with some OOP stuff, including proCall. While using procCall was working fine in my first tiny example, now for a more complex example with initialization I get a c compiler error. The code below may be similar to Ruby, where we generally define a initialize() method for