I think you could also do it in OOP style by defining a Subscriber object with a ‘changed’ method, then having the real subscribers subclass that and override the method. (Requires ‘pragma multimethods’, I think? I have to admit I haven’t tried any real OOP in Nim yet! I’d try it out in a playground but I’m on my phone right now...)
- How to implement observer (publish/subscribe) pattern? Kosteg
- Re: How to implement observer (publish/subscribe) pattern? dawkot
- Re: How to implement observer (publish/subscribe) pattern? Kosteg
- Re: How to implement observer (publish/subscribe) patt... snej