caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Martin Jambon <mjambon@burnham.org>
To: Jonathan Roewen <jonathan.roewen@gmail.com>
Cc: OCaml <caml-list@yquem.inria.fr>
Subject: Re: [Caml-list] revised syntax and immediate objects
Date: Tue, 4 Jul 2006 22:28:14 +0000 (GMT)	[thread overview]
Message-ID: <Pine.LNX.4.64.0607042220470.2533@droopy> (raw)
In-Reply-To: <ad8cfe7e0607041443k7e337b14h31d77a18999d865a@mail.gmail.com>

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 =<pr_r: not impl: expr; tag = 25>;
>
> 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."


  reply	other threads:[~2006-07-04 22:28 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 [this message]
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

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=Pine.LNX.4.64.0607042220470.2533@droopy \
    --to=mjambon@burnham.org \
    --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).