caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Nicolas Pouillard" <nicolas.pouillard@inria.fr>
To: "Jonathan Roewen" <jonathan.roewen@gmail.com>
Cc: OCaml <caml-list@yquem.inria.fr>
Subject: Re: [Caml-list] revised syntax and immediate objects
Date: Wed, 5 Jul 2006 09:29:28 +0200	[thread overview]
Message-ID: <cd67f63a0607050029n4722704drcd8000917e8c621a@mail.gmail.com> (raw)
In-Reply-To: <ad8cfe7e0607041443k7e337b14h31d77a18999d865a@mail.gmail.com>

On 7/4/06, Jonathan Roewen <jonathan.roewen@gmail.com> 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 =<pr_r: not impl: expr; tag = 25>;

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


      parent reply	other threads:[~2006-07-05  7:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-04 21:43 Jonathan Roewen
2006-07-04 22:28 ` Martin Jambon
2006-07-04 22:53 ` Matt Gushee
2006-07-04 23:07   ` Jonathan Roewen
2006-07-04 23:20     ` Matt Gushee
2006-07-05  8:19   ` Nicolas Pouillard
2006-07-05  7:29 ` Nicolas Pouillard [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cd67f63a0607050029n4722704drcd8000917e8c621a@mail.gmail.com \
    --to=nicolas.pouillard@inria.fr \
    --cc=caml-list@yquem.inria.fr \
    --cc=jonathan.roewen@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).