Murata Makoto wrote:
>
> I'm glad to hear that you have already considered this issue. However,
> I am afraid that I do not understand your restriction. I do not try
> to guess your intention but rather play a devil's advocate.
>
> >There's a restriction described in the tutorial (end of section 6) and
> >implemented in my sample implementation, but not yet described in the
> >spec (5.2 is a placeholder), that makes this illegal.
>
> In your tutorial, you mention <string> only. Is this a mistake?
Section 6 mentions only <string> because <data> hasn't been introduced
yet. Section 10.1 and 10.2 that introduces named and anonymous
datatyping say that the same restrictions apply to datatying that apply
to strings.
> >Say that a pattern p "distinguishes strings" if:
> >
> >- p matches t1 and
> >- p matches t2 and
> >- t1 and t2 differ only in their character children
>
> I do not understand.
Sorry, there was a crucial "not" missing:
- p matches t1 and
- p does not match t2 and
- t1 and t2 differ only in their character children
> What do you mean by "t1" and "t2? Two trees? Or, two hedges (zero or
> more trees possiblly prepended, interespersed, and followed by characters)?
> If they are hedges, what do you mean by "their characer children"? For example,
> let t1 and t2 be <foo/><bar>1</bar> and <foo/><bar>2</bar>, respectively.
> Do they "differ only in their character children"? What about
> <foo/><foo/> and <foo/>1<foo/>?
In spec the kind of thing that is matched against a pattern is a pair
<a, c> where a is an unordered collection of attributes and c is an
ordered collection of children (see section 2 of the spec). <a1, c1>
and <a2, c2> differ only in their character children iff <a1,
stripChars(c1)> is equal to <a2, stripChars(c2)> where stripChars(c)
returns the members of c that are not characters.
> >
> >(ie p contains <string> or <data> patterns; containing <anyString> alone
> >does not make p distinguish strings).
>
> What do you mean by "contain"? Occurrence as an *immediate* subordinate of the pattern?
> Or occurrence as an non-immediate subordinate if intervening patterns are not <element>
> or <attribute>?
The latter, except that <ref> elements are dereferenced as well.
> >Say that a pattern p "allows children" if there exists a tree t such
> >that p matches t and t has non-empty children (and not all whitespace).
>
> What do you mean by "tree" here?
<a, c> pair as usual.
> Hedges? Does <element name="foo"><empty/></element>
> allow children?
Yes: it allows a "foo" element. <empty/> does not "allow children" nor
does <attribute name="foo"/>.
> Then the restriction is that
> >
> > <group>p1 p2</group>
> >
> >is not allowed if
> >
> >- p1 distinguishes strings, and
> >- p2 allows children
> >
> >or vice-versa. Similarly for interleave and for any pattern that
>
> What do you mean by "vice-versa"? "if and only if"? Or,
> "p2 distinguishes strings, and p1 allows children"?
The latter.
James