caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Adding class initializers with camlp4
@ 2007-10-09 10:56 Joel Reymont
  2007-10-10 12:25 ` [Caml-list] " Nicolas Pouillard
  0 siblings, 1 reply; 2+ messages in thread
From: Joel Reymont @ 2007-10-09 10:56 UTC (permalink / raw)
  To: Caml List

Does anyone have examples of how to add initializer code to a class  
via camlp4?

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.

	Thanks, Joel

--
http://wagerlabs.com




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Caml-list] Adding class initializers with camlp4
  2007-10-09 10:56 Adding class initializers with camlp4 Joel Reymont
@ 2007-10-10 12:25 ` Nicolas Pouillard
  0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Pouillard @ 2007-10-10 12:25 UTC (permalink / raw)
  To: joelr1; +Cc: caml-list

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-10-10 12:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-09 10:56 Adding class initializers with camlp4 Joel Reymont
2007-10-10 12:25 ` [Caml-list] " Nicolas Pouillard

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).