caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Nicolas Pouillard" <nicolas.pouillard@inria.fr>
To: joelr1 <joelr1@gmail.com>
Cc: caml-list <caml-list@inria.fr>
Subject: Re: [Caml-list] Adding class initializers with camlp4
Date: Wed, 10 Oct 2007 14:25:43 +0200	[thread overview]
Message-ID: <1192019130-sup-7088@port-ext2.ensta.fr> (raw)
In-Reply-To: <DD69B17A-D12B-4D9D-A591-599660D530AC@gmail.com>

Excerpts from joelr1's message of Tue Oct 09 12:56:14 +0200 2007:
> Does anyone have examples of how to add initializer code to a class  
> via camlp4?

An  object  initializer  is a `class structure item' that can be created using
this quotation: <:class_str_item< initializer $e$ >> these initializers can be
used in a object structure in an expression or class
<:expr< object $class_str_item$ end >>.

> It's not clear to me how one can extend the list of existing  
> initializers, for example. There may be some or there may be none.  
> Same thing with fields.

The  list  is not explicit, however you can easily extend them on the front or
the back.

<:class_expr< object ($p$) $cstr$ end >> ->
  <:class_expr< object ($p$) initializer $e1$; $cst$; initializer $e2$ >>

HTH,

-- 
Nicolas Pouillard aka Ertai


      reply	other threads:[~2007-10-10 12:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-09 10:56 Joel Reymont
2007-10-10 12:25 ` Nicolas Pouillard [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=1192019130-sup-7088@port-ext2.ensta.fr \
    --to=nicolas.pouillard@inria.fr \
    --cc=caml-list@inria.fr \
    --cc=joelr1@gmail.com \
    /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).