Re: Non-equivalence of ref and bind

Steven & all,

One problem is that the dependency mechanism at the moment only
involves model bindings, but not UI bindings.

Upon refresh, the UI is supposed to update its bindings "as
necessary", while the model only fully updates its dependency tree
upon xforms:rebuild, which must be triggered explicitly sometimes,
depending on whether there are dynamic bindings or not.

I personally have to say that I think there is something wrong in the
first place with requiring explicit rebuilds from form authors (and I
am one myself). One reason is that it is hard to understand when a
manual rebuild is necessary. Another reason is that in an ideal
language, that kind of things should "just work" and be completely off
the mind of the form author.

I see two possible directions to solve your problem:

1. Extend the dependency mechanism to UI controls. This would then
    require the form author to perform rebuilds to update UI bindings
    instead of this happening "as necessary". But this would arguably
    be a step back, since a processor implementing "as necessary"
    correctly will do better than one requiring the form author to do a
    manual rebuild.

2. To say that dependencies in the model also update "as necessary"
    instead of ever requiring manual rebuilds. This would also allow
    smarter implementations to set the limit between so-called dynamic
    dependencies and others.

In your example, you have this excellent expression:

   instance('q')/lang[@code=instance('default')/lang]/q[@n='language']

Unless the structure of either instance changes, a good XPath
processor should be perfectly able to tell that the expression depends
on the value of the node instance('default')/lang. In other words no
rebuild is needed if that value changes, just a recalculate.

However currently, it seems that XForms actually *prevents* an XForms
processor to be as smart as that, which is a shame!

I already have an action item to make a proposal to rewrite the
language in the spec about dependencies, but I don't think this
actually tackles the question of refining our bad definition of what a
dynamic dependency is. But there is at least another LC comment from
Mike Kay on the topic of dynamic dependencies, so I think some further
work will have to happen here at some point.

So unfortunately it seems to me that fixing this falls in the "hard to
fix" category.

-Erik

Steven Pemberton wrote:
 >
 > I just stumbled on this (to my embarrassment that it hadn't occurred to
 > me earlier) but I consider it as a bad bug:
 >
 > If you replace
 >
 >       <label
 > 
ref="instance('q')/lang[@code=instance('default')/lang]/q[@n='language']"
 > />
 >
 > with what at first sight is the equivalent
 >
 >       <bind id="language"
 > 
nodeset="instance('q')/lang[@code=instance('default')/lang]/q[@n='language']" 

 > />
 >     ...
 >       <label bind="language" />
 >
 > it doesn't behave equivalently, because the second case needs an
 > explicit rebuild, and apparently the first doesn't.
 > How can this be? A bind ought to be equivalent to the use of a ref; and
 > any constraint-based system should be able to tell what needs updating.
 > Is this really hard to fix?
 >
 > Steven

-- 
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
http://www.orbeon.com/

Received on Wednesday, 11 July 2007 13:22:03 UTC