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 75630BB83 for ; Wed, 5 Jul 2006 09:29:28 +0200 (CEST) Received: from nf-out-0910.google.com (nf-out-0910.google.com [64.233.182.190]) by nez-perce.inria.fr (8.13.6/8.13.6) with ESMTP id k657TTM4006515 for ; Wed, 5 Jul 2006 09:29:29 +0200 Received: by nf-out-0910.google.com with SMTP id o60so245210nfa for ; Wed, 05 Jul 2006 00:29:28 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; b=cfgzhCRHnkWF3YMUMd8bAfe5n2okgKK2FP/Vz1DLVkELZB9UCrVvYDf5UB1glzDaXyUqHeC7nVPpCzGC3L3AxIT9nLKvOQ5GguC/Iz2eN90rTmUjRDrxwLZkiZ9L/TNG+lHkgZsYqN7Rjm2eE3QrzhheUbiQXB6xxWT6lYUsn9A= Received: by 10.78.138.14 with SMTP id l14mr1849904hud; Wed, 05 Jul 2006 00:29:28 -0700 (PDT) Received: by 10.78.13.17 with HTTP; Wed, 5 Jul 2006 00:29:28 -0700 (PDT) Message-ID: Date: Wed, 5 Jul 2006 09:29:28 +0200 From: "Nicolas Pouillard" Sender: nicolas.pouillard@gmail.com To: "Jonathan Roewen" Subject: Re: [Caml-list] revised syntax and immediate objects Cc: OCaml In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: X-Google-Sender-Auth: 996fe93bb9e982b1 X-Miltered: at nez-perce with ID 44AB6A59.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; syntax:01 syntax:01 ocaml:01 grammar:01 camlp:01 camlp:01 cmo:01 cmo:01 impl:01 expr:01 cvs:01 'let:01 wrote:01 caml-list:01 patt: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,RCVD_BY_IP autolearn=disabled version=3.0.3 On 7/4/06, Jonathan Roewen wrote: > Hi, Hi, > > What is the syntax for immediate objects in ocaml when using revised syntax? Yes, it's the same with mandatory semi-colons to separate class structure items. The grammar rule: "object"; opt_class_self_patt; class_structure; "end" > > 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 =; Yes, you're facing a programming style driven by laziness, this case is not implemented. Of course the new version of Camlp4 already in the official development CVS no more follow this programming way. Here is the result: $ camlp4o -printer OCamlr -str 'let obj a b c = object method a : int = a method b : string = b method c : string option = c end' value obj a b c = object method a : int = a; method b : string = b; method c : option string = c; end; > > I'd like to try make a camlp4 syntax extension that uses immediate > objects, and this isn't helping ;-) I hope the new version will be more pleasant to use :) -- Nicolas Pouillard