Re: references and dependency

Looking at this action item, I reread the new section "7.3 References,
Dependencies, and Dynamic Dependencies" [1]. Compared to XForms 1.1's
version [2], I prefer the new version as it is less convoluted and
higher-level.

There is the following text in the note for the XForms 1.1 version, which
got removed:

> For example, if the above expression were in a calculate, and if the
attribute of either b element changes to the value X, the expression would
be recalculated but it still does not record a reference to any c elements
until the references are obtained in the next rebuild operation.

That text kind of explained a dynamic dependency, but a little bit (or
much) too vaguely.

I think we could explain this using the updated example. For example,
introducing a bind and an input control:

```
<bind
    id="capital-bind"
    ref="continent[@name='Europe']/country[@name='France']/capital"/>

<input
    id="capital-input"
    bind="capital-bind"
    label="Capital"/>
```

Initially, because there is no `country` element with a `name` attribute
set to value `France`, the `capital-input` control binds to an empty
sequence and therefore is disabled.

Now let's consider the following action:

```
<setvalue
    ref="continent[@name = 'Europe']/country[@name = 'UK']/@name"
    value="'France'"/>
```

After this `<setvalue>`, the model does a `recalculate` and `revalidate`
and a `refresh` is performed. But the `capital-input` control remains
non-relevant if there is no explicit or implicit (for example via
`<insert>`) `rebuild` that is performed.

The following sequence of actions would properly make the `capital-input`
control appear:

```
<setvalue
    ref="continent[@name = 'Europe']/country[@name = 'UK']/@name"
    value="'France'"/>
<rebuild/>
```

I don't know if this or something along those lines would be worthwhile
adding. I still think that it leaves some aspects in the dark.

The key rule here is that *all binds keep pointing to the same node until a
`rebuild` happens*.

Interestingly enough, if things are done at the UI level, they are implied
to work. For example:

```
<input
    id="capital-input"
    ref="continent[@name='Europe']/country[@name='France']/capital"
    label="Capital"/>
```

would not require a `rebuild` since "All UI Expressions are re-evaluated as
necessary".

To discuss during the call.

-Erik

[1] https://www.w3.org/community/xformsusers/wiki/XForms_2.0#Dependencies
[2] https://www.w3.org/TR/xforms/#expr-dependencies


On Wed, Mar 22, 2017 at 12:43 AM, Steven Pemberton <steven.pemberton@cwi.nl>
wrote:

> The reason I took it out was because it was not used anywhere. I replaced
> it with an explanation of why sometimes a manual recalculate was necessary.
>
> Let's talk about it this afternoon.
>
> Steven
>
>
>
> On Wed, 22 Mar 2017 05:38:47 +0100, Erik Bruchez <ebruchez@orbeon.com>
> wrote:
>
> It should be enough to say that there are expressions with dynamic
>> dependencies, provide examples, and indicate that manual rebuilds are
>> needed in such cases.
>>
>> Do you think it is possible to create a canonical set of examples that
>> show when manual rebuilds are needed?
>>
>
> I notice that after the rewrite, there is no more mention of "dynamic
> dependencies". Should we still provide an example of dynamic dependency as
> we did for XForms 1.1 with:
>
>     https://www.w3.org/TR/xforms/#expr-dependencies
>
> -Erik
>
>
>
>
>

Received on Wednesday, 4 October 2017 05:17:41 UTC