caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Camlp4 3.10.0+beta: lists without $list:...$
@ 2007-03-23  6:13 Martin Jambon
  2007-03-23 16:03 ` [Caml-list] " Markus Mottl
  2007-03-23 16:35 ` Nicolas Pouillard
  0 siblings, 2 replies; 8+ messages in thread
From: Martin Jambon @ 2007-03-23  6:13 UTC (permalink / raw)
  To: caml-list

I managed to create an object type using camlp4orf:

let ctyp_object _loc ml =
   let fields =
     List.fold_left
       (fun o (name, typ) ->
 	 let m = <:ctyp< $lid:name$ : $typ$ >> in
 	 <:ctyp< $o$; $m$ >>)
       <:ctyp< >> ml in
   <:ctyp< < $fields$ > >>

where ml is a list of method declarations of type (string * ctyp) list.
Before we just had to do this:

<:ctyp< < $list:ml$ > >>


Is there anything simpler than my solution? Is a shortcut available?


If not, I think there should really be one. By the way, there should also 
be some shortcut for building list patterns and expressions without 
List.fold_*. A library could do that.


Martin


PS: any progress on the manual? It's kind of hard to test new features 
when you don't know what they are.

--
Martin Jambon
http://martin.jambon.free.fr


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

end of thread, other threads:[~2007-03-26  7:28 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-23  6:13 Camlp4 3.10.0+beta: lists without $list:...$ Martin Jambon
2007-03-23 16:03 ` [Caml-list] " Markus Mottl
2007-03-23 16:35 ` Nicolas Pouillard
2007-03-23 19:00   ` Martin Jambon
2007-03-24 12:21     ` Nicolas Pouillard
2007-03-24 20:24       ` Martin Jambon
2007-03-26  6:48         ` Markus Mottl
2007-03-26  7:27       ` Hendrik Tews

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