declarative expressons in WF2

This is a follow up to your email from a few days ago

> The new spec doesn't change the UA requirements, so you still (as 
> far as I can tell) require UAs to do static analysis of turing 
> complete code, which, here, reduces to the halting problem. (All 
> you've done is made such cases non-conforming, but that doesn't 
> affect the UA at all.)

I have introduced a grammar for a subset of ECMA 262 r-value 
expressions together with additional constraints that ensure that 
the expressions can be statically analysed. See:

   http://www.w3.org/2007/03/XForms-Transitional/#expr-syntax

> There are other problems, too, such as how to handle fields whose 
> exact lists of dependencies themselves depend on other field, e.g. 
> because the calculate="" field does something like:
>
>   calculate="document.forms[0][document.forms[0].field.value] + 1"

This isn't permitted and would result in an error when parsing the
expressions.

> It's also unclear to me how UAs should handle cyclic graphs (which 
> can't be sorted topologically) or graphs whose dependencies are 
> either truly or apparently random (e.g. because the field used 
> depends on the return value of an XMLHttpRequest call to a remote 
> server).

An exception is raised when cyclic dependencies are detected during 
the sort of fields found to depend on a field whose value has just 
been updated by user input. The dependencies must be statically
analysable and that rules out the use of a function or array access 
to obtain the name of a field, including the use of XMLHttpRequest.

The ability to access arrays and to call functions provides 
considerable flexibility, but places the responsibility of the 
scripter to avoid shooting himself in the foot. This has been the 
case for scripted event handlers since the introduction of 
scripting for HTML.

I am now in the midst of writing an experimental script library for 
Opera 9 that extends WF2 to support such expressions as a proof of 
concept that this can be made to work. We can argue about other 
aspects of WF2 separately. My primary goal is to ensure that the 
next version of HTML from W3C will allow people to create simple web 
applications without first needing to learn scripting and without 
relying on saving the semantics in some other format.


  Dave Raggett <dsr@w3.org> http://www.w3.org/People/Raggett

Received on Sunday, 25 March 2007 18:18:21 UTC