Re: self in classes

From: Didier Remy (remy@morgon.inria.fr)
Date: Mon Feb 08 1999 - 11:34:42 MET


Date: Mon, 8 Feb 1999 11:34:42 +0100
From: Didier Remy <remy@morgon.inria.fr>
To: =?iso-8859-1?Q?=EE=C9=CB=CF=CC=C1=CA_=E3=C9=D0=C1=CE=CF=D7?= <nicholas@post.tepkom.ru>
Subject: Re: self in classes
In-Reply-To: =?iso-8859-1?Q?=3CPine.LNX.4.03.9901151302590.11682-100000=40p?=

> Are there any ways to call the methods of other objects with self as an
> argument ?
> I mean situation like that:
> class foo = object (self)
> val observers : bar list = []
> method register =
> Array.iter (function o -> o#register self ) observers
> .... ^^^^^^^^^^^^^^^^^^

There is a similar example (the subject/observer pattern) in
the advanced tutorial http://caml.inria.fr/pub/old_caml_site/ocaml/htmlman/node5.html

-Didier



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