You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So we currently don't have any magical caching for content functions, wherein the same output of generate is reused for multiple arrangements of its slots. But that's coming, eventually, and when we merge attributes, we need to do so conscientiously!
Immediate merging is appropriate if multiple object literals are listed in a row. For example:
The first and second attribute sets should be combined immediately (at call of html.tag), but mysteriousOtherValue should be left exactly as it is - in place between the combined attributes above and {literalAttributes3} below, which also isn't combined with anything. (Unless another object literal were to follow it.)
The details of mysteriousOtherValue aren't important, only that it can be distinguished from object literals - it's likely to be either a symbol or an object with a global symbol attached.
Lazy combining should happen at time of toString() (or analogous serialization) - and it should behave just like immediate merging, only using the now-available slot values, in place as if they were just another object literal.
This isn't a pressing issue since it's not implemented, just worth keeping in mind when coming back around to cached or thread-transferred content functions.
The text was updated successfully, but these errors were encountered:
See #331: We should take care to implement merging in a generic, top-down manner - basically like the syntax for Object.assign. This should be separate from the main tag/attributes constructor, so it's easier to compose with a separate "only combine certain sets of attributes at once" behavior later on.
At the moment, Attributes.add and its various helpers all operate on a single live object, but that's only for the sake of mutation. Later on, the essential algorithm should be able to be refactored without much modification for #331.
So we currently don't have any magical caching for content functions, wherein the same output of
generate
is reused for multiple arrangements of its slots. But that's coming, eventually, and when we merge attributes, we need to do so conscientiously!Immediate merging is appropriate if multiple object literals are listed in a row. For example:
The first and second attribute sets should be combined immediately (at call of
html.tag
), butmysteriousOtherValue
should be left exactly as it is - in place between the combined attributes above and{literalAttributes3}
below, which also isn't combined with anything. (Unless another object literal were to follow it.)The details of
mysteriousOtherValue
aren't important, only that it can be distinguished from object literals - it's likely to be either a symbol or an object with a global symbol attached.Lazy combining should happen at time of
toString()
(or analogous serialization) - and it should behave just like immediate merging, only using the now-available slot values, in place as if they were just another object literal.This isn't a pressing issue since it's not implemented, just worth keeping in mind when coming back around to cached or thread-transferred content functions.
The text was updated successfully, but these errors were encountered: