Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Alain Frisch <alain@frisch.fr>
To: Peter Zotov <whitequark@whitequark.org>,
	 Jun Furuse <jun.furuse@gmail.com>
Cc: caml-list <caml-list@inria.fr>, caml-list-request@inria.fr
Subject: Re: [Caml-list] [ANN] ppx_overload : ppx for user definable SML style overloading
Date: Mon, 13 Oct 2014 16:54:29 +0200	[thread overview]
Message-ID: <543BE7A5.5090208@frisch.fr> (raw)
In-Reply-To: <8d73ce9dd0bb6d400565617d992736b5@whitequark.org>

On 10/13/2014 03:56 PM, Peter Zotov wrote:
> On 2014-10-13 17:49, Jun Furuse wrote:
>> Hi,
>>
>> I have OPAM-released ppx_overload, a ppx for user definable SML style
>> overloading.
>
> Hi,
>
> Great hack! I wanted to do something similar, but yours is much more
> elegant than what I had in mind.
>
> One note though:
>
>> Unfortunately this ppx trick does not work for the toplevel. It is
>> since OCaml toplevel
>> re-execute the ppx filter each time it gets a toplevel phrase. This
>> makes the ppx filter
>> hard to keep its state, in this case, the typing environment.
>
> In 4.02.1 the toplevel allows the ppx rewriter to save some state.
> See
> http://caml.inria.fr/cgi-bin/viewvc.cgi/ocaml/trunk/parsing/ast_mapper.mli?view=markup#l192.


And sedlex ( https://github.com/alainfrisch/sedlex ) illustrates one 
possible approach for storing the state.  Instead of marshaling in any 
form some kind of internal state, it simply stores fragments of 
parsetree (here, structure items) that impacted its internal state and 
simply replay them on later phrases.  (This is not very efficient, but 
for quick experiments in the toplevel, this is fine.)  I don't know if 
this technique would apply to ppx_overload.

-- Alain




  reply	other threads:[~2014-10-13 14:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-13 13:49 Jun Furuse
2014-10-13 13:56 ` Peter Zotov
2014-10-13 14:54   ` Alain Frisch [this message]
2014-10-14 13:08     ` Jun Furuse
2014-10-14 14:55       ` Peter Zotov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=543BE7A5.5090208@frisch.fr \
    --to=alain@frisch.fr \
    --cc=caml-list-request@inria.fr \
    --cc=caml-list@inria.fr \
    --cc=jun.furuse@gmail.com \
    --cc=whitequark@whitequark.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox