From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 42EBEBB83 for ; Wed, 5 Jul 2006 00:28:26 +0200 (CEST) Received: from out3.smtp.messagingengine.com (out3.smtp.messagingengine.com [66.111.4.27]) by nez-perce.inria.fr (8.13.6/8.13.6) with ESMTP id k64MSMk0003244 for ; Wed, 5 Jul 2006 00:28:27 +0200 Received: from frontend3.internal (frontend3.internal [10.202.2.152]) by frontend1.messagingengine.com (Postfix) with ESMTP id 24281D8AD35; Tue, 4 Jul 2006 18:28:20 -0400 (EDT) Received: from heartbeat2.messagingengine.com ([10.202.2.161]) by frontend3.internal (MEProxy); Tue, 04 Jul 2006 18:28:22 -0400 X-Sasl-enc: lJbHInbCB9jRh4QZoUm3nRm+CG5LYx9u1VcRvNTzi5gf 1152052102 Received: from [75.8.124.111] (unknown [75.8.124.111]) by mail.messagingengine.com (Postfix) with ESMTP id 076FF12D; Tue, 4 Jul 2006 18:28:21 -0400 (EDT) Date: Tue, 4 Jul 2006 22:28:14 +0000 (GMT) From: Martin Jambon X-X-Sender: martin@droopy To: Jonathan Roewen Cc: OCaml Subject: Re: [Caml-list] revised syntax and immediate objects In-Reply-To: Message-ID: References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Miltered: at nez-perce with ID 44AAEB86.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; syntax:01 syntax:01 ocaml:01 camlp:01 camlp:01 cmo:01 cmo:01 impl:01 expr:01 expr:01 ocaml:01 endline:01 wrote:01 caml-list:01 int:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.4 required=5.0 tests=DNS_FROM_RFC_ABUSE autolearn=disabled version=3.0.3 On Wed, 5 Jul 2006, Jonathan Roewen wrote: > Hi, > > What is the syntax for immediate objects in ocaml when using revised syntax? > > I was reading the camlp4 tutorial from the caml site, and the section > on objects just directs users to use camlp4o pr_r.cmo to dump an > example in revised syntax. > > The snippet of input code is thus: > > let obj a b c = object method a : int = a method b : string = b method > c : string option = c end;; > > The output from camlp4o pr_r.cmo gives: > > value obj a b c =; > > I'd like to try make a camlp4 syntax extension that uses immediate > objects, and this isn't helping ;-) As far as I can tell, the syntax is the same as in class_expr: $ cat toto.ml Ocaml.revised := true -- value o = object method hello = print_endline "Hello"; end ; o#hello ; $ ocamlscript toto.ml Hello Martin -- Martin Jambon, PhD http://martin.jambon.free.fr Sandy: "Don't you have to be stupid somewhere else?" Patrick: "Not until four."