I just spent a whole evening debugging a problem in my application with lazy because even though the component model had changed, lazy was memoizing the function. It was very confusing since events inside the component were firing, sort of (i.e. Html.App.map Msg.Foo (Html.Lazy.lazy Foo.view model.foo)). But were getting short-circuited up the subscription chain and the update functions making it unclear what the problem was. Normally if events aren't firing correctly, those are the two places of suspect along with the ports, but it was a view layer problem.
So I reread the documentation this morning to better understand what's going on. Some problems I noted: - lazy doesn't mean lazy evaluation--so right off the bat the name is actually wrong because it doesn't meet initial expectations. - "...just bundle the function and arguments up for later" is very vague. I know there's this idea that Elm doesn't want to scare people with *ideas *and *programming concepts*, but the documentation should technically explain that this library does a short-circuit with memoization--something people can use a search engine to dive in deeper to the concepts and those that already know can be like "oh okay, I know how this works because it's a part of my lexicon and programming domain knowledge". As it currently documented, the idea is very nebulous and I want something concrete to understand it. - As a user trying to understand where is the optimal place to start looking to test out where lazy can help, there is no documentation on where a red flag in your code should be a spot to try it. It's pretty much mysticism. There should be an physical toy example of a problem that lazy can solve and where lazy goes at the view layer. - There needs to be some cons listed about chewing up memory because it seems like a magical tool to fix everything. An example of value that changes too often should be listed as a when *not* to use it. - What would also be useful is some intro to new people on how to "definitely benchmark to be sure!". I'd assume that many people aren't sure what they're looking for. -- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
