Re: The interpretation of script

Noah Mendelsohn scripsit:

> Really? Consider:
>
> <script type="application/xml">
>   <newlang:program xmlns:newlang="...URI for the language...">
>        ...program in XML syntax goes here...
>        ...this should execute, just as javascript does...
>   </newlang:program>
> </script>

Assuming the surrounding document is text/html, then this is not XML
at all, but plain text, so "<newlang:program xmlns:newlang="...URI
for the language..."> has no meaning yet.  What does have meaning is
script/@type, which says this is application/xml, i.e. data.  If you
want it to be executed as a newlang program, script/@type should be
application/newlang+xml, or whatever its registered type is.

> How in general does a browser know whether something is >intended< as 
> code or data, if we authorize use of <script> for both?

Browsers recognize certain media types as representing code they know
how to execute, and execute them.  JavaScript code likewise recognize
certain media types as code *it* knows how to execute, and it executes it.
Whatever nobody recognizes is either data or junk DNA.  *Intent* doesn't
enter into it; intention is known only to the human author.

> AFAIK today, there is a risk that my browser won't support the language  
> used for the script, but there's no ambiguity that there >is< an 
> executable script, and that the intention is that it be run.  Once 
> <script> gets overloaded for data, you lose that distinction.

Application/xquery already blurs this distinction: it is data to the browser,
code to the xqib library.  This is really no big deal: the Lisp world has
gotten along fine without any such behavioral tagging for half a century.

> As I proposed on the phone, something like:
>
> <script type="application/xml" norun="true">
>   <data:items xmlns:data="...URI for the data model...">
>        ...please don't even try to execute data...
>   </data:items>
> </script>
>
> is crufty, but at least it disambiguates the cases.

It solves a problem that doesn't need solving.  

-- 
You know, you haven't stopped talking           John Cowan
since I came here. You must have been           http://www.ccil.org/~cowan
vaccinated with a phonograph needle.            cowan@ccil.org
        --Rufus T. Firefly

Received on Tuesday, 18 January 2011 05:23:35 UTC