Chuck Jazdzewski [G]

    Chuck Jazdzewski [G]

    3 years ago
    This can be done automatically (without needing
    Key
    ) if
    Item
    uses a
    @Pivotal
    parameter such as,
    fun Item(@Pivotal item: DataItem) {
       ...
    }
    then calls to
    Item
    automatically track the value of
    item
    .
    elizarov

    elizarov

    3 years ago
    Something that bugs me is why the annotation is
    @Pivotal
    and not
    @Key
    or something like it. The choice of the “pivotal” as the name of the feature seems highly unusual to me:
    Pivotal, adjective
    1. Of crucial importance in relation to the development or success of something else.
    2. Fixed on or as if on a pivot.
    … and 1st meaning usually springs to mind (pun intended) when reading
    @Pivotal
    Chuck Jazdzewski [G]

    Chuck Jazdzewski [G]

    3 years ago
    The second meaning is more what we were going for. Execution pivots on the value of the parameter.
    elizarov

    elizarov

    3 years ago
    But the second meaning is so rarely used, so even having seen its use multiple times I’m still having to pause each time I see it.
    Chuck Jazdzewski [G]

    Chuck Jazdzewski [G]

    3 years ago
    The first meaning is also there as well as you can rely on the instance of
    item
    being for any memoization done by the
    Item
    . An
    Image
    can mark
    src
    as pivotal and it knows that it will never be called with a different
    src
    for the same memoization location in the execution tree. This allows a
    launch
    of the read to be performed that is composition life-cycle aware and be cancelled automatically when the value of
    src
    changes at the call site.
    l

    Leland Richardson [G]

    3 years ago
    i’d be open to changing the naming here 🙂 I don’t think i’ve met one person who has liked it lol
    Chuck Jazdzewski [G]

    Chuck Jazdzewski [G]

    3 years ago
    Naming is hard...
    elizarov

    elizarov

    3 years ago
    I’d suggest to use “key” as a consistent grammatical base and the choose among
    Key
    ,
    Keyed
    ,
    WithKey
    , etc for annotation and function names. It is indeed hard, since it has to align with other functions out there that brining some non-visible things into the tree context.
    For example. One option could be
    @Key
    annotation and
    withKey(key) { ... }
    composable function with lower-case letter signifying that it is not really a visual component in any sense (does this distinction make sense? I don’t know)
    l

    Leland Richardson [G]

    3 years ago
    yeah i think something like this makes sense
    or maybe
    keyedBy(...) { ... }
    Chuck Jazdzewski [G]

    Chuck Jazdzewski [G]

    3 years ago
    I added this to the now growing list of terms we should reconsider.
    l

    Leland Richardson [G]

    3 years ago
    👍