[wg-camlp4] Against the use of syntactically-valid OCaml code for syntax extension purposes
Alain Frisch
alain at frisch.fr
Wed Jan 30 09:44:29 GMT 2013
On 01/30/2013 10:27 AM, Xavier Clerc wrote:
> Personally, I think that declaring attributes with their fields
> and types is pretty useful.
I don't see how to do that without introducing a lot of complexity in
the system. Do you mean we should run the OCaml type-checker on
attribute arguments before they are processed? Or that we should
restrict attribute arguments to be pure constant data (records,
constructors, literals)? This seems overly restrictive. It make sense
to allow full expressions within attributes (e.g. some uses of type-conv
requires to annotate types with functions), and I don't see how to
type-check that.
> This protects the user from some
> typos and other obvious errors, and avoid boiler-plate code in
> the attribute processors.
I don't expect a lot of tedious boiler-plate code in the processors
(OCaml is not so bad at pattern matching, after all) if they need to
check some "constraints" on their arguments (not really type-checking,
but rather checking simple things like the fact that they come with a
string literal argument).
Alain
More information about the wg-camlp4
mailing list