Re: Pragma Proposal ready for review

Return comments inline.

On Tue, 14 Dec 2021 at 14:27, C. M. Sperberg-McQueen
<cmsmcq@blackmesatech.com> wrote:

> > (Potential) issue, circularity? A mods B mods A? Can this be
> > addressed?
>
> I believe (a) you are right that there is at least a potential
> circularity, and (b) that Tom and I found a way to bootstrap things so
> that circularity is avoided.

Should this be documented somewhere? I think so?

>
> > Namespace declarations: Applicability (xml rules apply?), how is
> > scope related to the generated XML?
>
> The proposal before us allows namespace declarations only before the
> first rule of the grammar, which has the consequence that they apply
> throughout the grammar and thus throughout the generated XML.

+1. Does this 'block' an element changing its ns mid document?
I hope so. (KISS principle)

>
> > At what point is ixml validation 'assumed'? Post pragma application?
> > Where stated?
>
> Not stated explicitly.  Since the effect of pragma application is not
> defined, we cannot define the shape of a grammar after pragma
> application, and the grammar in the spec defines the grammar with
> pragmas in place, not whatever one ends up with after applying a
> pragma (in cases where the phrase "applying a pragma" has a clear
> meaning, which it won't always have).

I don't recall reading that anywhere?
It also places clear boundaries on the process (which I find good).

"we cannot define the shape of a grammar after pragma
application"  I can see where that comes from ... 'implementer business', but...
surely 'the output of pragma application shall be valid ixml' or
something? Or....
What's it all about?


>
> > "Some of these use cases seem most naturally handled by annotations
> > which apply to a grammar as a whole, some by annotations which apply
> > to individual rules, and some by annotations which apply to
> > individual symbols in the grammar."  I don't find this clear, I
> > don't understand its implication.
>
> I hope the examples made it clearer.
>
> All it means is that if you ask "what does this pragma do?" the
> natural-language answer will in some cases say that it does this or
> that to a particular occurrence of a symbol, or to one particular
> rule, or to the grammar as a whole.  My instinct is to think that it
> is helpful to be clear on which it is -- in XQuery annotations and
> extension expression, for example, it is always clear what expression
> is being annotated or modified by extension.

OK Michael. I'll leave that for another day and hope others grok it.


>
> > Is the 'fallback' action(expression) implementable? If a processor
> > fails to 'understand' a pragma? Is it the same action expected of
> > every pragma not understood?
>
> The fallback expression is the expression modified by / annoted by the
> pragma, and the fallback processing is to process the grammar as if
> the pragma were not present, so yes, I think it's always
> implementable.

Heck. You put it in reverse, I don't do reverse, I'm going to keep on
going forward? That sort of thing?
  As a user I think I'd be cross with someone / something?
  Is error reporting a dirty word?


>
> > 3rd desiderata: Superficially this would appear (to me) as pure
> > magic?  I don't understand it, yet I'm expected to produce XML from
> > it?
>
> I hope the details of the proposal made it clearer how this works.

Again, I'll pass to others.

>
> Even if a processor doesn't understand the pragma, it will understand
> the syntactic form of the pragma as defined in the ixml grammar for
> ixml, and the required XML has the same relation to that syntactic
> form as for any ixml grammar.

Mmmm. You haven't seen some of the mistakes I can make Michael?
You may be expecting rather a lot from users?


>
> > Design questions: Could pragmas be 'associated with' (external to) a
> > grammar as apposed to within it? How to 'point to' the modified
> > grammar element?
>
> Not in this proposal, no.

Understood.

>
> > If a pragma results in a non-wellformed XML output, is that a user
> >  issue?
>
> I think it's either a quality-of-implementation issue for the
> processor that produces the non-wf output, or a
> quality-of-specification issue for the document that defines the
> pragma itself.
>
> Nuffin to do wiv me, guv.

Michael 'Teflon shoulders'? Bit smelly?
How to trace back from non wf xml to ixml to pragma (course it is the pragma -
most awkward alternative!).
   Do you think that feasible | desirable (user view says yes please)


>
> > ## The brackets-QName proposal
>
> > Scope issue: "Serializing a nonterminal as an element or attribute
> > whose name is taken not from the grammar (as in ixml as currently
> > specified) but from the input data." Implies that pragmas scope
> > extends beyond ixml to other data sources? Is this a required
> > complexity? I'd vote against this.
>
> Not sure I follow here.
>
> The idea is that the pragma affects the way a processor serializes
> the parse tree.  The scope of the pragma (as I understand the term)
> is a clearly defined region in the grammar.  The effect of
> understanding and implementing the pragma will be visible in the
> output, without the pragma's scope extending outside the grammar.

<grin/> So why not say that - which I find v.clear!


>
> > Fixed form: [? qname Variable form:
>
> > "all pragmas have the same representation in XML grammars."  Is this
> > a valid statement?
>
> The use of 'same' is perhaps a little loose.  They will have different
> pragma data and different pragma names and different pragma marks.
> But they will all be elements named 'pragma'.

Could this be stated in xml tree ideas / description? I *think* the examples
hint at that?

>
> > "The xml form of pragmas" - is this of use to a user? First
> > introduction, I'm unsure if / when it may be of use.
>
> Since I work quite a lot with ixml grammars in XML form, I am keen to
> have pragmas well defined in the XML form of the grammar.

I ask again, would an end-user find the xml form 'useful' - if so how please?


>
> > "Any pragma recognized can be written out in ixml notation. " A bit
> > tautological? Surely it needs to be written out in ixml notation to
> > be recognised?
>
> I think that pragmas can be defined so that they can be recognized
> within the XML form of the grammar.

See question above (unless this is not a user sphere of interest).

>
>
> > ## Worked examples
>
> > "... and that namespace bindings should remain constant throughout
> > the grammar " Now that would be helpful :-)
>
> > "a pragma-aware processor " First mention - should be defined, also
> > action on a non-aware processor finding a pragma
>
> The term 'pragma-aware' may have been ill chosen.

"pre-processor" ixml-m4? macro expansion? If pragma processing
is clean and pre-ixml processing... is that (they) an appropriate name?


>
> If the proposal is adopted, all processors must be aware that pragmas
> may occur in grammars and must be prepared to parse them.
>
> In this bit, 'pragma-aware processor' was meant to denote a processor
> which understands some pragmas and must be able to tell whether a
> pragma it encounters in a grammar is a pragma it understands, or a
> pragma it does not understand.

Oh! MSM has prag-1, ndw has prag-2 - and X understands one but not
the other! I've only just cottoned on to that idea. Is this the fallback idea?
Sort of makes more sense now. Tks.

>
> A processor that 'understands' no pragmas does not have that task:  it
> can simply parse past all pragmas and ignore them when parsing input
> against the grammar.

Only so long as the processor can find the end of each pragma? Is that
guaranteed? mmmm.


>
> > "at least one thing must be specified in the spec for the
> > bootstrapping process to work: either a magic prefix, analogous to
> > the xmlns prefix of the XML Names recommendation" Seems a sensible
> > way of processing, to (re)use xmlns? +1 from me.
>
> You may be right.  My views are colored by the fact that I hated the
> way the namespaces spec solves this problem and still hate it twenty
> years later.

You might think that, I couldn't possibly comment :-)
Have we all become to used to it to change Michael?




Tks for the reply Michael.

regards


-- 
Dave Pawson
XSLT XSL-FO FAQ.
Docbook FAQ.

Received on Tuesday, 14 December 2021 14:52:43 UTC