XForms 1.1 is Turing complete.

John M. Boyer, Ph.D.
Senior Product Architect/Research Scientist
Co-Chair, W3C XForms Working Group
Workplace, Portal and Collaboration Software
IBM Victoria Software Lab
E-Mail: [EMAIL PROTECTED]  http://www.ibm.com/software/

Blog: http://www.ibm.com/developerworks/blogs/page/JohnBoyer




Henri Sivonen <[EMAIL PROTECTED]>
Sent by: [EMAIL PROTECTED]

09/06/2006 04:29 AM

To
Dave Raggett <[EMAIL PROTECTED]>
cc
Lachlan Hunt <[EMAIL PROTECTED]>, [EMAIL PROTECTED], [email protected]
Subject
Re: A forms-lite straw man






On Sep 6, 2006, at 01:27, Dave Raggett wrote:

> On Tue, 5 Sep 2006, Henri Sivonen wrote:
>
>> It is possible and even convenient to use _javascript_ closures  
>> attached to the DOM nodes of form fields for binding the form  
>> fields with an XHR-load/saved data model document tree. Such an  
>> arrangement has the benefit that it is backwards-compatible with  
>> existing Web browsers (including IE6).
>
> But why go to such difficulties when a declarative solution is
> achievable?

I didn't find it a difficulty, and it worked with the existing  
browsers that I was required to support. Indeed also for someone else  
doing similar things, compatibility with notable existing browsers  
would likely be an important consideration.

> A cross platform _javascript_ libarary can provide
> support for existing browsers, enabling authors to focus on
> declarative markup rather than scripting.

A few lines of _javascript_ closure creation on top of existing  
interoperable browser features is a simpler solution than including a  
_javascript_-based interpreter for a declarative language.

> Also from what I hear,
> many developers are having trouble with Ajax and XHR.

That's only anecdotal evidence and even if it were representative, it  
wouldn't follow that the same people wouldn't be having trouble if  
they were using XPath or XForms instead.

>>> If the _expression_ evaluates to false, the field is considered to  
>>> be invalid. I got the name wrong and it should have been called  
>>> validate. The _expression_ could act over just the field's value,  
>>> but it could also refer to the values of other fields. It could  
>>> even call out to a function defined as part of a web page script.
>>
>> What is the advantage over calling a _javascript_ function from the  
>> onchange handler? http://whatwg.org/specs/web-forms/current-work/
>> #setcustomvalidity
>
> If you are good at maintaining custom _javascript_, then perhaps the
> benefit is less valuable to you, but a simple _expression_ will be
> easier to check for others.

If indeed a simple _expression_ is enough, it could be a single  
_javascript_ _expression_ wrapped in a this.setCustomValidity() statement.

I fail to see how having more programming arsenal than mere  
expressions available to the developer would cause difficulty or  
hardship for the developer. I do understand that one cannot do the  
kind of static analyses on arbitrary _javascript_ that one could do on  
purely functional programs. However, I value the things that  
_javascript_ allows me to do today more than I value the potential  
future benefits that the ability of user agents to statically analyze  
expressions might provide.

> Sure, a Turing complete procedural solution is indeed very powerful,
> but that's the point. A more constrained approach is easier to
> verify against the application requirements.

It seems to me that verification methods for computer programs have  
not--over the many years the subject matter has been researched--
reached a level of practicality where one could apply verification  
methods to non-trivial code without an undue effort or undue  
restrictions on the programming paradigm or methodology. Moreover,  
formal verification of software against requirements only moves to  
human error to another stage: the stage of formally expressing the  
requirements.

> I guess I won't be able to convince you of the
> benefits of declarative representations.

I quite like Turing-complete imperative languages for developing  
applications. :-)

--
Henri Sivonen
[EMAIL PROTECTED]
http://hsivonen.iki.fi/




Reply via email to