[Prev][Next][Index][Thread]
Re: make() and initialize()?
-
To: info-dylan@ai.mit.edu
-
Subject: Re: make() and initialize()?
-
From: "Scott McKay" <swm@mediaone.net>
-
Date: Sun, 21 May 2000 16:30:02 -0400 (EDT)
-
Organization: Road Runner
-
References: <200005211856.OAA21139@life.ai.mit.edu>
-
Xref: traf.lcs.mit.edu comp.lang.dylan:12046
Nolan Darilek wrote in message <200005211856.OAA21139@life.ai.mit.edu>...
>I've finally encountered a situation in which I'd like to override the
>default/generated constructors. I've seen code which overrides make,
>and code which overrides initialize on the new class. What is the
>difference between make() and initialize()?
'make' allocates a new instance. You can completely override 'make',
for example, if you are maintaining a cache of objects and want to
return an existing object. 'make(<vector>)' in Fun-O Dylan does this
to return a canonical empty vector, e.g.
'initialize' initializes its slots. You can't completely override
'initialize'
methods. They should always have a call to 'next-method()' in there
somewhere, most often at the very beginning.