Re: Need for a 'global instance' function [was Re: i18n, componentized forms and multiple models]

Hi Erik,

> But wouldn't allowing this function to be called from a model encourage
> breaking encapsulation? Wouldn't events be enough as a mechanism to
> communicate between models?
>
> For use within controls I don't disagree though. Maybe the instance()
> function could simply take an optional second parameter, that would
> indicate if the search for instances should be global:
>
> [...]

We felt that having a different function made it clearer that we were
really doing a lookup, rather than establishing a connection between
the models. The point here is that we actually *don't* want a
'connection' between the models, since this 'leak' would then require
longer rebuilds. But we *do* want to be able to reference data in
other models, such as when using an instance as a source of templates
for xf:insert.

There are actually many situations in XForms where you use a value in
a calculation on a 'per-use' basis, such as in xf:setvalue or
xf:insert, and since this creates no dependency, it's not going to
hurt to be able to get data from other models for these actions.

As it happens, in most of our stuff we don't have expressions that mix
models within one XPath statement; what we try to do is use our
encapsulation techniques, and just copy out the data we need with
setvalue or insert. So far we've kept our use of globalInstance() to
that, and it has worked pretty well.

Regards,

Mark

-- 
Mark Birbeck
CEO
x-port.net Ltd.

e: Mark.Birbeck@x-port.net
t: +44 (0) 20 7689 9232
w: http://www.formsPlayer.com/
b: http://internet-apps.blogspot.com/

Download our XForms processor from
http://www.formsPlayer.com/

Received on Monday, 24 July 2006 22:43:18 UTC