Re: Pragma strawman

Steven Pemberton <steven.pemberton@cwi.nl> writes:
>> As I said, I’m not a fan of conflating comment markup with pragma
>> markup. We have the freedom to do better.
> Pragmas are machine-readable comments.

Where does it say that?

Pragmas and their close relatives, annotations, are sometimes shoehorned
into comments, but I attribute that to contraints of language design
where they got added after the first release. I don’t think it’s the
right answer on basic principles. And it’s not the only mechanism by a
long shot. Consider:

Java:

  @Annotation("parameters")
  public void method()

Python:

  @classmethod
  def function(cls):

C:

  #define thing

RELAX NG:

  [
   db:refname [ "title" ]
   db:refpurpose [ "This is the title" ]
  ]
  div {
   title = element title { text }
  }

D:

  pragma(crt_constructor)
  extern(C) void initializer()

> Delete them, and nothing changes.

If that’s true, it’s because they’re defined that way, not because they
happen to share a sytactic similarity to comments.

By the way, are you proposing that an annotation must not change the
semantics of a grammar? I’ve certainly been in conversations where I got
the impression that the semantic impact of an annotation was
unconstrained.

> If we don't agree on that, then I think we have to start anew with a
> requirements analysis, because that means we're designing something
> that we haven't yet agreed on the purpose of (which I'm beginning to
> suspect).

What do you believe is the purpose of pragmas?

>> > {*ixml=http://invisiblexml.org/ixml This is a pragma}
>> …
>> > {*ixml this is a later pragma to the same processor}
>>
>> Uhm. That feels *a whole lot* like sneaking namespaces into the spec,
>> except uglier, harder to use, and more error prone.
>
> It's no more namespaces than than the use of URIs in RDF is.

One of the reasons we *have* namespaces in XML is precisely *because* a
shortcut syntax was needed for RDF/XML.

What you’ve provided is a mechanism for making an association between a
URI and a short name so that the short name can be used in place of the
URI. That’s basically namespaces.

> If we
> agree that URIs are the way to unambiguously identify things without
> clashes, then we should use them. I included the short name, because
> Michael was asking for brevity, but if you don't like them, we can
> delete that part and just use the URI.

If we are going to have namespaces in ixml, in v1 or later, then that
should be the mechanism for making global identifiers. I’d rather not
have a separate mechanism for global identifiers now for pragmas.

If the consensus of the WG is that a comment-based syntax is the right
approach for pragmas, and we aren’t going to have namespaces in v1, I
propose that pragmas be identified by a single NCName.

{*myannotation this is my annotation data}

Once we’ve sorted out namespaces, we can allow:

{*my:annotation this is my annotation data}

                                        Be seeing you,
                                          norm

--
Norm Tovey-Walsh
Saxonica

Received on Thursday, 13 January 2022 16:29:39 UTC