caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jacques Garrigue <garrigue@kurims.kyoto-u.ac.jp>
To: andrew@absentis.com
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Passing self to a new object
Date: Tue, 30 Oct 2001 17:09:19 +0900	[thread overview]
Message-ID: <20011030170919O.garrigue@kurims.kyoto-u.ac.jp> (raw)
In-Reply-To: <20011029203036.A1039@alba.sw>

From: Andrew Lawson <andrew@absentis.com>

> > The general solution to this is to first define a class type:
> >   class type xyz_t = object ('self)
> >      method 
> >        btnNew : ...
> >        ...
> >      end
> 
> 	Well this gives me an excuse to start playing with types and
> interfaces  anyway.  Is this a 'known problem, will be sorted
> eventually' or a 'just live with it' sort of thing?

Well, this was delayed for a very long time, but I'm starting to think
that we should really do something about it.

> > Then change the code in btnNew to
> >   new abc (self :> xyz_t)
> 
> 	 Casting! and here was I giving a C++ programmer some abuse
> about this last week :)

No, this is a coercion. This is perfectly type-safe (and checked at
compile time).  This is needed for type inference. Languages with
explicit type information, like Java, do it silently.

Cheers,

Jacques Garrigue
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


      reply	other threads:[~2001-10-30  8:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-28 15:56 Andrew Lawson
2001-10-29  9:02 ` Jacques Garrigue
2001-10-29 20:30   ` Andrew Lawson
2001-10-30  8:09     ` Jacques Garrigue [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=20011030170919O.garrigue@kurims.kyoto-u.ac.jp \
    --to=garrigue@kurims.kyoto-u.ac.jp \
    --cc=andrew@absentis.com \
    --cc=caml-list@inria.fr \
    /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).