<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Apr 10, 2013 at 3:21 PM, Leo White <span dir="ltr"><<a href="mailto:lpw25@cam.ac.uk" target="_blank">lpw25@cam.ac.uk</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">> I think we should keep the Parsetree type as close as possible (at reasonable costs) to the set of ASTs that can be<br>

> produced by the parser. This will reduce the risk of generating Parsetree fragments which cannot be pretty-printed (as<br>
> source code) faithfully.<br>
<br>
</div>In general I agree with this, however there are always going to be<br>
places where the Parsetree accepts more values than the parser.<br></blockquote><div>Actually, that's the value of polymorphic variants,  you can make the type definitions <br></div><div>as precise as the parser while not complicate the type definitions too much<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im"><br>
> So, if we want to move from "string loc list" to "core_type list" (which will give attributes for free on parameters),<br>
> we should accept arbitrary types in the parser and fail in the type-checker.  (There is no real drawback for the<br>
> end-user.)  The problem is that this  introduces conflicts in the grammar.  The simpler way I've found to address them<br>
> without changing the parser too much is to add the variance prefixes (+ and -) as new constructors in core_type (with<br>
> corresponding grammar rules), but this is not very nice.<br>
<br>
</div>Adding variance constructors to core_type seems like it will create more<br>
problems than it solves.  I think it would be simpler to have type<br>
parameters only accept Ptyp_any, Ptyp_var and Ptyp_extension.<br>
<div class="HOEnZb"><div class="h5">_______________________________________________<br>
wg-camlp4 mailing list<br>
<a href="mailto:wg-camlp4@lists.ocaml.org">wg-camlp4@lists.ocaml.org</a><br>
<a href="http://lists.ocaml.org/listinfo/wg-camlp4" target="_blank">http://lists.ocaml.org/listinfo/wg-camlp4</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>-- Regards, Hongbo
</div></div>