[wg-camlp4] [Caml-devel] Keeping attributes in .cmi files?
Alain Frisch
alain.frisch at lexifi.com
Thu Sep 19 16:55:43 BST 2013
On 09/19/2013 04:04 PM, Jacques Garrigue wrote:
> But what are the scoping rules?
> Do you mean that the annotations are actually open terms? Interesting.
There is no semantics, no binding structure, the payload of attributes
and extension points are just fragments of surface syntax. The meaning
is given by the tools which manipulate them.
>> I expect arguments of attributes to be rather small fragments of syntax, so I don't see any real problem here. Are you concerned by the size of .cmi file on disk, the time to read them?
>
> Both, as they are connected. Also the fact that this might keep some unnecessary details.
I really think performance is a non-issue here. For usual cases, each
attribute will add a few bytes to the .cmi file.
>> Of course, one could simplify the internal representation of "payloads" (attribute and extension node arguments) to a single case in the internal representation, and keep alternative syntaxes only as sugar, but what is the benefit?
>
> A more uniform semantics ?
> Again, I do not say that this should be the representation used, but saying that the two are equivalent clarifies the semantics.
They are not currently equivalent: a ppx filter could very well react
properly on:
[@invariant? A | B]
and fail on:
[@invariant (function A | B -> true | _ -> false)]
If we decide to consider the first form as syntactic sugar second for
the second form, then yes, they become equivalent!
Alain
More information about the wg-camlp4
mailing list