Calling the generics parent function

2023-11-24 Thread thedistantforest
Oh that was easy! Thanks! Didn't occur to me that the square brackets explicitly calls the generic function (though it makes perfect sense now in hindsight). Thanks everyone for the help! Pretty cool that there are lots of solutions to this.

Calling the generics parent function

2023-11-24 Thread thedistantforest
Yes I was thinking of doing this if I didn't find any other way. I think it's not too bad of a solution as well.

Calling the generics parent function

2023-11-24 Thread Isofruit
Ahh, now that makes more sense, thanks for the edit :-D

Calling the generics parent function

2023-11-24 Thread Isofruit
I mean, in general you can just call the generic explicitly with `update[Enemy](self)` like so: type Enemy = ref object EntGroup[T] = ref object items: seq[T] proc update[T](self: EntGroup[T]) = echo "general update loop" proc update(s

Calling the generics parent function

2023-11-24 Thread Isofruit
What exactly does that have to do with OP?

Calling the generics parent function

2023-11-24 Thread Boston
Hope this isn't too ugly

Calling the generics parent function

2023-11-24 Thread Boston
Pasted the wrong link, fixed it now

Calling the generics parent function

2023-11-23 Thread blackmius
But i found more preferably to just rename base update to `updateBase` and call it so

Calling the generics parent function

2023-11-23 Thread blackmius
`type Enemy = ref object EntGroup[T] = ref object of RootObj items: seq[T] EnemyEntGroup = ref object of EntGroup[Enemy] method update[T](self: EntGroup[T]) = echo "general update loop" method update(self: EnemyEntGroup) = procCall update(EntGroup[Enemy](self)) ## << What to put here to call the

Calling the generics parent function

2023-11-23 Thread thedistantforest
Hi I'm trying to run a proc that uses generics. There will be a general update[T] proc for normal use, and a specific proc for any custom code I would want to add. eg update[Enemy] for any enemy specific code. Here is a code example of what I mean: type EntGroup[T] = ref object