#Typing sendParent

1 messages · Page 1 of 1 (latest)

ebon creek
#

Is there any way to properly type sendParent with the parent's events? I'd assume I could type a machine to allow only parents that accept a certain (minimum) set of events or at least some type parameter to sendParent, but I can't find anything about this in the documentation...

wintry sedge
#

Right now, it's not possible to know the type of the parent, since a machine can be spawned from pretty much any machine

#

But yes, in v5, @main sandal and I were talking about ways to type an "actor behavior" (e.g. machine) as "I can only be spawned by parent(s) that extend this type"

main sandal
#

Right now u would have to wrap sendParent with your own types to its arguments, that wouldnt exactly make your parent-child communication completely safe but it could spare u some typos and errors

ebon creek
#

Awesome, thanks!