W3C home > Mailing lists > Public > public-ixml@w3.org > June 2021

pragmas - a proposal

From: C. M. Sperberg-McQueen <cmsmcq@blackmesatech.com>
Date: Mon, 7 Jun 2021 21:07:31 -0600
Message-Id: <1ACF3BEF-E27A-4F8B-91EA-30CF2496D18C@blackmesatech.com>
Cc: "C. M. Sperberg-McQueen" <cmsmcq@blackmesatech.com>
To: public-ixml@w3.org

If we're meeting tomorrow, I'd like to propose a topic for the 'any other business' portion of the meeting.  (I am aware that (a) there is no such heading in the agenda Steven sent out, and (b) if there were, the chances of our reaching it are slender at best.)

In [1], I mentioned that I thought that pragmas might help with the syntactic challenges arising from any attempt to support text injection and namespace injection.  I'm not sure that makes a lot of sense, but I do think we would do well to define a notation for pragmas.  

[1] https://lists.w3.org/Archives/Public/public-ixml/2021May/0002.html

By 'pragma', I mean expressions which extend ixml in an implementation-defined way, which will typically be supported by some implementations but not all.  The goal of defining a notation for pragmas in the language is to allow implementations which do not understand or support the extension in question to parse the notation correctly and ignore it.

One approach would be just to define a subset of comments as having this meaning.  For example, any comment of the form {!EQname ... !} could be a pragma.  Implementations that understand the qualified name will behave appropriately, and other implementations will treat it as a comment.  I use ! here, but any other character would work.  {? ... ?} would echo XML processing instructions (which are, I suppose, a form of pragma).  

Another approach would be to define a different pair of delimiters for pragmas, because in some applications there may be a lot of them, and it would be nice if they could be short(er).  Possible delimiters might be:  ‹ › or « » or ⦃ ⦄ or 〚 〛or ⸢ ⸣ -- any Unicode pair would do, I suppose.

To mark some rules as green and others as blue, for example, an ixml extension at http://example.com/grammar-colors might do something like this (assuming that URI is bound to the prefix 'gc'):

    a {!gc:green!}:  b, c. 
    b {!gc:blue!}: d, e. 
    ...

Analogies with other languages with pragmas might lead one to expect or prefer something like:

    {!gc:green!} a :  b, c. 
    {!gc:blue!} b: d, e. 

but I expect pragmas to be treated as whitespace, and the whitespace before the left-hand side of a rule belongs to the preceding rule.

Michael



********************************************
C. M. Sperberg-McQueen
Black Mesa Technologies LLC
cmsmcq@blackmesatech.com
http://www.blackmesatech.com
********************************************
Received on Tuesday, 8 June 2021 03:08:33 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 8 June 2021 03:09:18 UTC