[Newbies] Overriding methods
Blake
blake at kingdomrpg.com
Sun Jan 20 19:09:27 UTC 2008
On Sun, 20 Jan 2008 04:37:17 -0800, <johnps11 at bigpond.com> wrote:
> Hi Blake!
>
> I've yet to find a situation where I can't put the code that would be in
> a constructor in C++ into #initialize. I suppose there are situations
> where that would be a bad idea, but I just haven't met them, or else I'm
> doing
> bad things (very likely).
In the abstract, I'd say if the class knows something the instance
shouldn't.
> Every time I get that kind of a warning I treat it as a 'is there a
> better way?' flag. It'd be great if one of the non-newbies on this list
> could
> explain when (or why) it is a better idea to override #new rather than
> instantiate fields in #initialize or via lazy initialization.
Yeah, I think that's why the warning is there. And I understand it (sorta)
for #basicNew.
It just seems kind of hyper for #new. I guess it's because #new is obliged
(sorta) to call #initialize, and this is not a universal Smalltalk
tradition.
===Blake===
More information about the Beginners
mailing list