[Ur] UrWeb SVG inclusion trial, needs revision
    Adam Chlipala 
    adamc at csail.mit.edu
       
    Fri Mar 13 13:07:54 EDT 2015
    
    
  
Thanks for looking into this extension!
On 03/13/2015 06:25 AM, Gabriel Riba wrote:
> Although it is well explained in the manual (XML section), it is not 
> easy to understand when there are several abstract concepts, that your 
> mind easily skips.
>
> Specially the type constructor "tag" it is confound with the value 
> "tag" (that builds up xml subtrees with specific tag) but the 
> different parameters they take augments the confusion.
The idea of separate namespaces for types and values is pretty common; 
Ur/Web inherits it from SML.  You see the same thing with, e.g., class 
constructors in C++.  I don't think it's inherently confusing, and 
usually it even improves understanding, by avoiding the need to add some 
extra nonsense prefix or suffix to an identifier for disambiguation.
> > val svg : unit -> tag svgTagAttrs body svg [] []
> >
> > There is a quirk, since SVG can be an html level tag but also an
> > inner svg fragment container, but I have not treated this case.
>
> The "svg" tag establishes a new coordinate system. The fragments can be
> set up with the grouping tag "g", without redefining the coordinate 
> system.
>
> I could not find a way to encode two possible outer context 
> requirements for the svg tag.
Yeah, the XML encoding is not set up to support tags that work in 
multiple contexts where there is no single /most general/ context that 
subsumes all the options.  Your example seems to need separate contexts 
for <body> and <svg>, where either case supports some tag that is not 
legal in the other.
One easy-to-implement workaround is to use a /separate tag/ for nested 
SVG, with a different name.  Then modify src/monoize.sml to add a 
special case renaming that tag to <svg> in compiled code, for instance 
by copying the code in the place that maps "tabl" to "table" right now.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.impredicative.com/pipermail/ur/attachments/20150313/3a7fb892/attachment.html>
    
    
More information about the Ur
mailing list