Re: creating fresh objects of type 'self

From: Didier Remy (
Date: Mon Apr 12 1999 - 10:33:28 MET DST

Date: Mon, 12 Apr 1999 10:33:28 +0200
From: Didier Remy <>
To: Markus Mottl <>
Subject: Re: creating fresh objects of type 'self
In-Reply-To: <>; from Markus Mottl on Fri, Apr 09, 1999 at 11:56:44PM +0100

> is there a convenient way of creating objects of type 'self in classes?
> Cloning is easy, e.g:
> class foo = object
> method clone = {< >}
> end
> which yields an object not necessarily of type "foo" but possibly of
> a subclass.


> But I wonder, how I can do something similar to get a "fresh" object.

The method clone already gives you a fresh copy of the original object. So
why aren't you happy with the method clone?

> I would like to be able to have something like:
> class foo = object (_ : 'self)
> method create = new 'self
> end
> The only possibility I know to get the intended result is rather
> inconvenient: I do as in "clone", but reinitialize all member data with
> their initial data. This is not only error-prone, but possibly quite a
> lot of work.

I don't understand what you mean here.

> The original idea is to have a parent *object* passing "self" to a child
> *object* it has just created itself (note that I mean concrete objects,
> not classes).

I still don't undertand what you really want to do.

Best regards,


This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:22 MET