From: Ted Kremenek <kremenek@cs.stanford.edu>
To: Gerd Stolpmann <info@gerd-stolpmann.de>
Cc: Ocaml <caml-list@inria.fr>
Subject: Re: [Caml-list] Class/prototype-based OO
Date: Tue, 29 Aug 2006 11:13:08 -0700 [thread overview]
Message-ID: <39D25033-09DF-4051-81F8-A99CD407A265@cs.stanford.edu> (raw)
In-Reply-To: <1156853008.21883.84.camel@localhost.localdomain>
On Aug 29, 2006, at 5:03 AM, Gerd Stolpmann wrote:
> Certainly not this way. Simply use exceptions for home-made RTTI:
>
> class type foo = ...
>
> exception Foo of foo
>
> class foo_class : foo =
> object(self)
> ...
> method downcast = raise(Foo(self : #foo :> foo))
> end
>
>
> let downcast_foo (obj : < downcast : unit; ..>) =
> try obj # downcast
> with Foo x -> x
> | _ -> failwith "This is not a foo!"
>
>
> Although this is restricted to monomorphic types please note that the
> other languages you mention only have this sort of types.
This is a cute idea. I'm glad that you mentioned the point about
monomorphic types. Hypothetically, is there any need for
"polymorphic" downcasts?
next prev parent reply other threads:[~2006-08-29 18:13 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-25 7:51 David Baelde
2006-08-25 11:31 ` [Caml-list] " skaller
2006-08-29 3:11 ` Ted Kremenek
2006-08-29 5:53 ` skaller
2006-08-30 23:57 ` brogoff
2006-08-29 12:03 ` Gerd Stolpmann
2006-08-29 17:56 ` Ted Kremenek
2006-08-29 18:13 ` Ted Kremenek [this message]
2006-08-31 1:11 ` Jacques Garrigue
2006-08-31 5:18 ` skaller
2006-08-31 6:36 ` Jacques Garrigue
2006-08-31 7:15 ` skaller
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=39D25033-09DF-4051-81F8-A99CD407A265@cs.stanford.edu \
--to=kremenek@cs.stanford.edu \
--cc=caml-list@inria.fr \
--cc=info@gerd-stolpmann.de \
/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