is subclassing Project OK?
Torge Husfeldt
Torge.Husfeldt at gmx.de
Wed Aug 7 10:02:47 UTC 2002
Hi Ned,
I can only guess here but it may have to do with performance or with the urge not to directly reference classes in Methods. On the other hand there is already a call to #isKindOf: in the method so I don't know if these points are valid. Obviously the author must not have imagined someone subclassing Project.
Don't you think it would be a Good Idea (tm) to replace quite a few calls to #isKindOf: <Class> by is<Class>? Some time ago i wrote a snippet that did exactly this and posted it to the list (It works with the #autoDeclineClassMembership preference that dates from the same time, but you could make it work with explicit "is<Class> ^false" methods in Object too), but it didn't receive much of an echo at that time.
Squeak on,
Torge
Ned Konz wrote:
>
> I have a subclass of Project. I saved one of them as a project, then
> when I went to load it back in, I was told that no project was in the
> file!
>
> Looking further, I found the following logic in ProjectLoading
> class>>openName:stream:fromDirectory:withProjectView:
>
> (morphOrList isKindOf: ImageSegment) ifTrue: [
> proj _ morphOrList arrayOfRoots
> detect: [:mm | mm class == Project]
> ifNone: [^self inform: 'No project found in this file'].
>
> I changed the "class == Project" to "class isKindOf: Project" and it
> seems to run OK, but is there some reason that the code is this way?
>
> Thanks,
> --
> Ned Konz
> http://bike-nomad.com
> GPG key ID: BEEA7EFE
More information about the Squeak-dev
mailing list
|