From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id VAA19284; Thu, 22 May 2003 21:48:57 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id VAA19282 for ; Thu, 22 May 2003 21:48:55 +0200 (MET DST) Received: from dewberry.cc.columbia.edu (dewberry.cc.columbia.edu [128.59.59.68]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id h4MJmsH26211 for ; Thu, 22 May 2003 21:48:54 +0200 (MET DST) Received: from tw304h3.cpmc.columbia.edu (tw304h3.cpmc.columbia.edu [156.111.84.180]) (user=ot14 mech=LOGIN bits=0) by dewberry.cc.columbia.edu (8.12.8p1/8.12.8) with ESMTP id h4MJmqqZ022803 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NOT); Thu, 22 May 2003 15:48:53 -0400 (EDT) From: Oleg Trott To: Basile STARYNKEVITCH , Ed L Cashin Subject: Re: [Caml-list] my first questions about camlp4 Date: Thu, 22 May 2003 15:48:19 -0400 User-Agent: KMail/1.5.1 Cc: caml-list@inria.fr References: <20030522025118.37681.qmail@mail.com> <87y90zvunc.fsf@cs.uga.edu> <16077.1526.521835.393248@hector.lesours> In-Reply-To: <16077.1526.521835.393248@hector.lesours> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200305221548.19503.oleg_trott@columbia.edu> X-No-Spam-Score: Local X-Scanned-By: MIMEDefang 2.32 (www . roaringpenguin . com / mimedefang) X-Spam: no; 0.00; oleg:01 caml-list:01 camlp:01 basile:01 non-standard:01 redefining:01 lacks:01 persistency:01 compiler:01 ocaml:01 lisp:01 writes:01 syntax:02 harder:02 purely:02 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Thursday 22 May 2003 01:16 pm, Basile STARYNKEVITCH wrote: > >>>>> "Ed" == Ed L Cashin writes: > > Ed> "Dont Bother" writes: > >> 1. It's been said that Camlp4 is not as easy to use as Lisp > >> macros, but is it as powerful? Is there anything that can be > >> done with Lisp macros that can not be done using Camlp4 in the > >> context of their respective languages? > > Ed> You might get a better answer to that question on > Ed> comp.lang.lisp. [...] > > > I do know a tiny bit CL, and I do practice Ocaml with Camlp4. It seems > to me that CommonLisp macros can -for example- interact with CL object > system, while Camlp4 is purely syntactic (in that sense, it is more > like Scheme macros). For example, I tend to believe that you can make > a commonlisp macro which, given a class name C, extract all the fields > F of this class C such that F name ends with a suffix S and generate a > printing routine which prints only those fields. I think that this is > not possible in Camlp4 (unless you redefine in Camlp4 the syntax > defining Ocaml classes). I think Lisp is too huge for anyone to make statements as to what's NOT in it with certainty, but I suspect that to do what you are describing, one would need a non-standard function like CLASS-SLOTS. In any event, whether this is the case is incidental. More interestingly, if you were to have to augment DEFCLASS with this functionality, would it be easier than redefining OCaml class syntax in Camlp4? The former is fairly easy, because you know exactly where to find field names within DEFCLASS form : - take the fourth element of the form, which has to be a list; - for each of its elements, do: - if the element is a list, its head is one of the field names - otherwise, it's a field name itself I imagine this would probably be harder to do with OCaml & Camlp4 (Unless, perhaps, you happen to be the author of "camlp4/meta/pa_o.ml" ) > In a more general way, I do think that Ocaml still lacks some > reflective abilities (which could help for other things, > e.g. persistency). It does seem like integrating Camlp4 into the compiler could offer interesting possibilities. > Also, macros are an essential part of CommonLisp; for example, they > are repeatedly used for CommonLisp advocacy, :-) -- Oleg Trott ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners