Skip to content

How much logic should we embed in fluent values? #1645

@samreid

Description

@samreid

In working on this issue, I realized that writing:

      myFluentKey:             >-
                           { $screenType ->
                           [sumScreen] Special string for the sumScreen
                           *[other] String for the other screens.
                           }

Is a significant improvement over:

myFluentKeyOnTheSumScreen: Special string for the sumScreen
myFluentKeyOnOtherScreens: String for the other screens.

Because of how much it streamlines the call site. Now I no longer need to pass through different strings, choose between them, and add other listeners (if screen were dynamic), instead we just bind it with createProperty. I feel like we may want to aggregate more things in our fluent in the future, and this helps answer questions we previously had about "how do we describe the same component in different contexts?" It doesn't need different string keys in the yaml, it just needs to know about the context with fluent variables.

I'd like to check in with @marlitas about this philosophy, and to ask if we should push more in this direction for existing code (perhaps combining bar and bond descriptions?) or if we agree this is good for new code.

Originally posted by @samreid in #344

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions