Re: On pragmas…

On Tue, 2022-03-29 at 15:52 -0600, C. M. Sperberg-McQueen wrote:
> 
> I should have said that "many" (not "the only") plausible use cases
> for
> pragmas in a language involve communicating information not
> expressible
> in the language as specified.


I still think the answer is to allow pragmas anywhere people want to
put them (at least between tokens) and not to worry about it further.
The people who do nasty things with them will do them anyway.

Is there a taxonomy of pragmas? (prgamata?)

Some XQuery implementations i've used have pragmas to suggest that a
function be expanded inline wherever calls to it occur, for performance
reasons.

I can imagine a pragma that says, when you see this token, replace its
value (or computed content) with the result of calling this function
supplied by the implementation - e.g.
stock-ticker-symbol (# value: get-company-name() #);

That's because i don't think you can define or use functions in ixml.

Another might be to issue a trace line each time a production is
encountered/reduced.

Another might be to say, the contents of this item are actually in 
utf16 and not utf8, and most be converted until you get to the end
marker.

With some pragmas you'll get wrong results if they're not understood or
available - just as you wlil get wrong results from the 1.x docbook
XSLT stylesheets in some cases if particular extensions are not
available (e.g. xt:document).

Being able to mark a pragma as essential sounds as useful as
standalone="no" did in XML days, and is as likely to be ignored.

Without pragmas, people can for example make token conventions -- you
include a grammar fragment that won't match your input, and that
contains a reference to a token like my:BeginUseShortestMatch.

You cannot say in a specification (at least i can't, at least not with
a straight face), anything about what non-conforming implementations
do, beyond that they must not claim to conform. So where people want
extensions that are not interoperable they will find a way to make
them, and without pragmas they may be impossible or at least difficult
to detect automatically.  That's not healthy for a language, but then,
i come from an Anglican background -- if we can't find a reason to
forbid it, allow it, after long deliberation :)

Pragmas are used by some people in Python but since the language
doesn't support them directly, they write a comment starting with the
word pragma.

-- 
Liam Quin, https://www.delightfulcomputing.com/
Available for XML/Document/Information Architecture/XSLT/
XSL/XQuery/Web/Text Processing/A11Y training, work & consulting.
Barefoot Web-slave, antique illustrations:  http://www.fromoldbooks.org

Received on Wednesday, 30 March 2022 03:09:23 UTC