Tapestry 5
  1. Tapestry 5
  2. TAP5-777

Tapestry should ensure that mixins are applied in a deterministic order.

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 5.1.0.5
    • Fix Version/s: 5.2.0
    • Component/s: None
    • Labels:
      None

      Description

      Currently, the only ordering tapestry does on mixins is to ensure that render phase methods on @MixinAfter mixins are invoked after the corresponding component event handler.
      Beyond that, ordering is stochastic. It would be nice if mixins were applied in a deterministic order. Consider the case where a mixin shortcuts some phase of rendering. Another mixin may need that phase to be executed to perform properly. With stochastic ordering, the resulting behavior is basically unknown and could vary from application executing to application execution. With deterministic ordering, the mixins could be defined in such a way that both mixins function properly.

      As I see it, there are two ways this problem could be solved.
      One is to have a simple, pre-defined ordering, something like: template mixins in the order they are defined, followed by mixins defined via the @Mixins annotation in the order listed, followed by the implementation mixins, in the order the field are defined in the class. This has the advantage of simplicity. However, I can imagine scenarios where one might want an instance mixin to execute before an implementation mixin. The ordering could be reverse, but then the opposite problem applies: what if you want something executed after?
      A compromise would be something like: @Mixins mixins, @Mixin mixins, template-defined mixins. But this starts to get confusing.

      An alternative approach would be to allow the ordering of mixins to be defined explicitly, similar to how ordered configurations are defined and processed. Something like:
      <t:textfield t:mixins="mixina,mixinb;before:*,mixinc,mixind;after:mixina mixinb"/>

      This would be backwards compatible in that:
      <t:textfield t:mixins="mixina,mixinb,mixinc,mixind"/> would still function, and would function as before: stochastic ordering, whereas the first approach would slightly alter component/mixin behavior for previously defined component trees.

        Activity

        Robert Zeigler created issue -
        Robert Zeigler made changes -
        Field Original Value New Value
        Assignee Robert Zeigler [ ongakugainochi ]
        Robert Zeigler made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        Robert Zeigler made changes -
        Status In Progress [ 3 ] Closed [ 6 ]
        Fix Version/s 5.2 [ 12313900 ]
        Resolution Fixed [ 1 ]
        Robert Zeigler made changes -
        Fix Version/s 5.2.0.0 [ 12314122 ]
        Fix Version/s 5.2 [ 12313900 ]

          People

          • Assignee:
            Robert Zeigler
            Reporter:
            Robert Zeigler
          • Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development