caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] my first questions about camlp4
@ 2003-05-22  2:51 Dont Bother
  2003-05-22 16:00 ` Ed L Cashin
  0 siblings, 1 reply; 5+ messages in thread
From: Dont Bother @ 2003-05-22  2:51 UTC (permalink / raw)
  To: caml-list

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?

2. Has Camlp4 been completely orphaned or is it still developed by INRIA?

3. If an error is detected by OCaml in the code produced by Camlp4, how does Camlp4 decide what to tell the user? Camlp4 is a separate program, so how does it do it?

4. SML/NJ also has some quote and antiquote operators. How do they relate to Camlp4 and Lisp macros w.r.t. power and ease-of-use?

5. I think most Lisp programmers actively use macros. Do many working Caml programmers use Camlp4? Humps have only a handful of Camlp4-related projects.
-- 
__________________________________________________________
Sign-up for your own FREE Personalized E-mail at Mail.com
http://www.mail.com/?sr=signup

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


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

* Re: [Caml-list] my first questions about camlp4
  2003-05-22  2:51 [Caml-list] my first questions about camlp4 Dont Bother
@ 2003-05-22 16:00 ` Ed L Cashin
  2003-05-22 17:16   ` Basile STARYNKEVITCH
  0 siblings, 1 reply; 5+ messages in thread
From: Ed L Cashin @ 2003-05-22 16:00 UTC (permalink / raw)
  To: caml-list

"Dont Bother" <dont_bother@whoever.com> 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?

You might get a better answer to that question on comp.lang.lisp.  I
know there are people there who know ocaml -- I don't know whether
they know camlp4, but I bet there are some.

-- 
--Ed L Cashin     PGP public key: http://noserose.net/e/pgp/

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


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

* Re: [Caml-list] my first questions about camlp4
  2003-05-22 16:00 ` Ed L Cashin
@ 2003-05-22 17:16   ` Basile STARYNKEVITCH
  2003-05-22 19:48     ` Oleg Trott
  2003-05-22 19:50     ` [Caml-list] Camlp4 and hashtable Lukasz Lew
  0 siblings, 2 replies; 5+ messages in thread
From: Basile STARYNKEVITCH @ 2003-05-22 17:16 UTC (permalink / raw)
  To: Ed L Cashin; +Cc: caml-list

>>>>> "Ed" == Ed L Cashin <ecashin@uga.edu> writes:

    Ed> "Dont Bother" <dont_bother@whoever.com> 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).

In a more general way, I do think that Ocaml still lacks some
reflective abilities (which could help for other things,
e.g. persistency).

Also, macros are an essential part of CommonLisp; for example, they
are repeatedly used for CommonLisp advocacy, while Camlp4 is not yet
used systematically by Ocaml believers.


-- 

Basile STARYNKEVITCH         http://starynkevitch.net/Basile/ 
email: basile<at>starynkevitch<dot>net 
aliases: basile<at>tunes<dot>org = bstarynk<at>nerim<dot>net
8, rue de la Faïencerie, 92340 Bourg La Reine, France

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


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

* Re: [Caml-list] my first questions about camlp4
  2003-05-22 17:16   ` Basile STARYNKEVITCH
@ 2003-05-22 19:48     ` Oleg Trott
  2003-05-22 19:50     ` [Caml-list] Camlp4 and hashtable Lukasz Lew
  1 sibling, 0 replies; 5+ messages in thread
From: Oleg Trott @ 2003-05-22 19:48 UTC (permalink / raw)
  To: Basile STARYNKEVITCH, Ed L Cashin; +Cc: caml-list

On Thursday 22 May 2003 01:16 pm, Basile STARYNKEVITCH wrote:
> >>>>> "Ed" == Ed L Cashin <ecashin@uga.edu> writes:
>
>     Ed> "Dont Bother" <dont_bother@whoever.com> 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 <oleg_trott@columbia.edu>

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


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

* [Caml-list] Camlp4 and hashtable
  2003-05-22 17:16   ` Basile STARYNKEVITCH
  2003-05-22 19:48     ` Oleg Trott
@ 2003-05-22 19:50     ` Lukasz Lew
  1 sibling, 0 replies; 5+ messages in thread
From: Lukasz Lew @ 2003-05-22 19:50 UTC (permalink / raw)
  To: caml-list

Hi.
Is it possible to implement with camlp4 syntax for using hashtables like 
arrays?
I think about something like this:

# let a = [{ }];;
val a : ('_a, '_b) Hashtbl.t = <abstr>

# a.{"foo"} <- 'f';;
- : unit = ()

Regards,
Lukasz Lew


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


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

end of thread, other threads:[~2003-05-22 19:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-22  2:51 [Caml-list] my first questions about camlp4 Dont Bother
2003-05-22 16:00 ` Ed L Cashin
2003-05-22 17:16   ` Basile STARYNKEVITCH
2003-05-22 19:48     ` Oleg Trott
2003-05-22 19:50     ` [Caml-list] Camlp4 and hashtable Lukasz Lew

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