Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: whitequark <whitequark@whitequark.org>
To: François Pottier <francois.pottier@inria.fr>
Cc: caml users <caml-list@inria.fr>
Subject: Re: [Caml-list] ppx_deriving question: deferring code generation?
Date: Fri, 06 Jan 2017 22:58:45 +0000	[thread overview]
Message-ID: <afb2edafca674707e3bace87ea47d253@whitequark.org> (raw)
In-Reply-To: <9576980c-9aad-4af2-e512-dc9c42743cf2@inria.fr>

On 2017-01-04 13:08, François Pottier wrote:
> I am imagining that perhaps the user could write something like this:
> 
>   type foo =
>     Bar | Baz
>     [@@deriving visitors { delayed = true }
> 
>   let x : foo option ref =
>     ref None
> 
>   [@@visitors]
> 
> The effect of the flag { delayed = true } would be to store the 
> generated code
> somewhere in memory (instead of emitting right away), and the effect of 
> the
> floating attribute [@@visitors] would be to fetch that code from memory 
> and
> emit it.
> 
> To me, this seems somewhat ugly, but workable. Does ppx_deriving offer 
> a
> better approach? Does anyone have a better suggestion? Comments are
> appreciated.

ppx_deriving currently does not allow for any (non-horrible) way to do 
this.
I am OK with the approach you propose.

-- 
whitequark

      parent reply	other threads:[~2017-01-06 22:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-04 13:08 François Pottier
2017-01-04 13:49 ` Gabriel Scherer
2017-01-04 15:37   ` François Pottier
2017-01-04 13:53 ` Christoph Höger
2017-01-04 15:58   ` François Pottier
2017-01-04 15:20 ` Alain Frisch
2017-01-04 16:04   ` François Pottier
2017-01-06 22:58 ` whitequark [this message]

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=afb2edafca674707e3bace87ea47d253@whitequark.org \
    --to=whitequark@whitequark.org \
    --cc=caml-list@inria.fr \
    --cc=francois.pottier@inria.fr \
    /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