glimmer-vm
glimmer-vm copied to clipboard
SubExpressions are evaluated eagerly when const
{{!-- still called: unexpected! --}}
{{if false (-do-not-call)}}
{{!-- this works correctly --}}
{{if false (-do-not-call this.notConstArg)}}
In the first case, we still called the helper because we noticed that all its args are const, so we computed it eagerly.
Not 100% sure what to make of this.
On one hand, we don't really guarantee that it is lazily called (e.g. this probably wouldn't be considered a bug if reported in Ember), but on the other hand it seems pretty unfortunate to eagerly compute when it is never needed.
I don't fully grok why we have to invoke that helper in the constructor vs just propagating the constness in the new references tag and allowing its .value to actually do the calculation. :thinking: