- From: Graydon <graydonish@gmail.com>
- Date: Tue, 11 Feb 2025 21:43:06 -0500
- To: Bethan Tovey-Walsh <bytheway@linguacelta.com>
- Cc: Norm Tovey-Walsh <norm@saxonica.com>, ixml <public-ixml@w3.org>
On Mon, Feb 10, 2025 at 01:15:09AM +0000, Bethan Tovey-Walsh scripsit: > Indeed, I suspect that anything you can imagine doing with a pragma > annotating a pragma, you can instead do with a single pragma. Formally, I would also expect so. A pragma in scope for a non-terminal and the same pragma in scope for another non-terminal that becomes a descendant of the XML element generated by the first non-terminal might need to have a defined interaction all the same. It could be left up to the implementers, but if there's any notion of scope it might be preferable to define which instance of the pragma applies in what context. In requirements language, something like "a pragma must apply to one and only one grammar construct". Possibly "at least one and no more than one grammar construct which is always the same grammar construct throughout an evaluation of the grammar if the evalutation considers that pragma". > > Might it be agreed that the pragma scope needs to be identifiable? > > Unfortunately, discussion about Requirements 9 and 10 in the last CG > meeting revealed some fervent objection to the idea that the > specification should say anything at all about pragma scope. I should be curious as to which use cases are advanced where a pragma of no or arbitrary scope is useful. [snip] > A pragma's scope tells us which grammar construct provides > its context. > > Seen from a different perspective, scope is a matter of where the > pragma belongs in the grammar's hierarchy. A pragma essentially has a > parent, which provides its scope. I think that makes sense; as a user, I would like to know what parts of the grammar to which the pragma will apply, and (presumably) an implementor necessarily has the same concern. Which means you have to (in some informal sense) bind a pragma to a grammar construct for a pragma to be useful. This does not allow the "a pragma is a comment" identity, though; or at least, I think comments CAN hover between two rules. Which would require that the pragma syntax is unique and specified; implementers would not be free to tell you that some specific string in a comment is magic. (Since I can't think of any language which defines pragmas without giving them a specific syntax this does not strike me as alarming.) -- Graydon -- Graydon Saunders | graydonish@fastmail.com Þæs oferéode, ðisses swá mæg. -- Deor ("That passed, so may this.")
Received on Wednesday, 12 February 2025 02:43:13 UTC