caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Kakadu <kakadu.hafanana@gmail.com>
To: Caml List <caml-list@inria.fr>
Subject: [Caml-list] Ppx_deriving and plugins for plugins (aka metaplugins)
Date: Wed, 13 Jul 2016 12:34:31 +0300	[thread overview]
Message-ID: <CAGmVoG1earsSMc9g_vxFs-wbhaqHaGEmYQOzgpp3GNQVUzHAPg@mail.gmail.com> (raw)

Salut, fellas

Let's say I want to create a few derivers which should generate two
parts of code:
1) specific for this family of derivers;
2) specific for concrete deriver.
For example

[@@deriving der_family { deriver1; deriver2 }]

should generate

(* XXX  code specific for family *)
(* ZZZ1 code which relies on XXX and which is specific for deriver1 *)
(* ZZZ2 code which relies on XXX and which is specific for deriver2 *)

And  [@@deriving der_family { deriver1}] should generate

(* XXX  code specific for family *)
(* YYY code which relies on XXX and which is specific for deriver1 *)

This approach should work well until I wish to support [@@deriving
der_family { deriver3 }] as a separate project. AFAIU, at the moment
ppx_deriving chooses plugin by it's exported name (i.e. der_family in
[@@deriving der_family { deriver3 }] ) but it seems that I need some
parametrization over deriver parameters.

Is it already supported? Is it easy to implement? Or I should do this
in a more straightforward manner?

Happy hacking,
Kakadu

                 reply	other threads:[~2016-07-13  9:34 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=CAGmVoG1earsSMc9g_vxFs-wbhaqHaGEmYQOzgpp3GNQVUzHAPg@mail.gmail.com \
    --to=kakadu.hafanana@gmail.com \
    --cc=caml-list@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;
as well as URLs for NNTP newsgroup(s).