Open jberdine opened 3 years ago
This is indeed desirable, and in fact we attempted this change at some point. However, the change ended up too massive and too disruptive because of how often people abuse this "feature" to derive sexp conversions for types that don't exist, so we gave up.
Perhaps some day we'll try again, if we can come up with a way to make the change incrementally, but I'm afraid that day is not today.
Thanks for the context! This is indeed very tempting to abuse, so not so surprising. I wonder if a way forward would be to add support to ppx_sexp to accept a cookie so that if e.g. --cookie 'ppx_sexp_strict="1"'
is passed then the strict interpretation is used. Then projects could add a cookies
clause to their dune files to indicate that they conform to the stricter interpretation, and maybe one day the default could be switched.
Yeah, that sounds like a workable approach.
There is an irregularity between
%sexp_of
and e.g.%compare
. Consider:This triggers
(and the same for
v
).On the other hand, omitting the type parameters:
triggers
on the definition of
compare
, whilesexp_of_t
is ok.