[plt-scheme] Unifying xexpr, SXML, and SHTML

From: Sam TH (samth at ccs.neu.edu)
Date: Tue Mar 10 09:00:03 EDT 2009

On Tue, Mar 10, 2009 at 8:44 AM, Neil Van Dyke <neil at neilvandyke.org> wrote:
> Matthias Felleisen wrote at 03/10/2009 08:13 AM:
>>
>> 1. Consider using Typed Scheme to formulate the type of XEXPRs you want to
>> use.
>
> Typed Scheme does have its appeal for this -- for checking in terms of XML
> metamodel types (e.g., "element", "cdata"), and, more interestingly, in
> terms of XML DTD or XSL model types (e.g., "movie", "title", "director").

I think representing XML schemas (in the general sense) would require
a more powerful type system than Typed Scheme.

> I have been thinking of only making small changes to unify "xexpr" and SXML,
> and therefore keeping a sexp-based representation.
>
> If you are suggesting formulating the types for a sexp-based representation
> using Typed Scheme, is Typed Scheme's current implementation smart enough to
> avoid lots of redundant type divining of deep sexp trees?  For example, if a
> large "xexpr" tree is built up incrementally from, say, a hundred thousand
> sexps, nested in various ways, are there situations in which there will
> there be lots of redundant traversals of deep subtrees to re-divine the
> types?

If you were to write a Typed Scheme program that used such a type, it
would not incur any overhead in itself, but passing data back and
forth with other modules would require contract checks that would have
to descend into the full structure of the data, which might be
problematic for performance.

It is also hard to use a general data structure library with Typed
Scheme, since it's not currently possible to generate polymorphic
contracts.  I'm not sure if an XML library would run into this, it
would depend on the representation you chose.

-- 
sam th
samth at ccs.neu.edu


Posted on the users mailing list.