My understanding is that yes, Elm does this with every update and then the effects managers have to look at the new subscriptions and compare them to the old subscriptions. I would love to hear that my understanding is wrong because while this isn't bad if you have just a few subscriptions, it seems like potentially a lot of overhead if you have a lot of subscriptions.
One could envision subscriptions being implemented more like views in which there would be a differ that would generate patches to send to the effects managers and there would be a subscription equivalent to Html.Lazy that would cut off a lot of the computation when nothing had changed. This would probably make frequent update to subscriptions less scary computationally but it isn't how things are done. Finally, you haven't asked the other subtle question brought on by dynamic subscriptions: if you stop returning a subscription, are you guaranteed that you won't receive any messages targeted to that subscription or are you only guaranteeing that no more messages will be queued or even weaker are you only letting the effects manager know that you aren't really interested any more? Mark On Fri, Jul 21, 2017 at 6:55 AM Vasily Vasilkov <vasily.vasil...@gmail.com> wrote: > Does it mean that Elm runtime creates and cancels subscriptions on the fly > (for every model change)? > > > > On Mon, Jul 17, 2017 at 6:19 PM +0400, "Marek Fajkus" <marek....@gmail.com > > wrote: > > Sometimes you don't need subscriptions if you're in some state. For >> instance, if you have game and subscription to say mouse position you can >> subscribe to Mouse.position only when a user is in play state and avoid >> subscription in game menu. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Elm Discuss" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to elm-discuss+unsubscr...@googlegroups.com. >> For more options, visit https://groups.google.com/d/optout. >> > -- > You received this message because you are subscribed to the Google Groups > "Elm Discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to elm-discuss+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Elm Discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.