[squeak-dev] Re: Multiple issues with class definition
Andreas Raab
andreas.raab at gmx.de
Fri Apr 10 16:11:05 UTC 2009
Igor Stasenko wrote:
> Just two doits to reproduce the problem:
>
> Object subclass: #Blabla
> instanceVariableNames: ''
> classVariableNames: ''
> poolDictionaries: ''
> category: 'Whatever'.
>
> Object variableSubclass: #Blabla
> instanceVariableNames: ''
> classVariableNames: ''
> poolDictionaries: ''
> category: 'Whatever'.
>
> i wonder what the reason of preventing me to redefine a mistakenly
> defined class, which having 0 methods? And even if i have the methods,
> so what?
This is a bug. I could track this to a change somewhere between Squeak
3.2 and Squeak 3.6 (i.e., the bug is not in 3.2 but is in 3.6) where a
consistence check was changed from #subclassesDo: to #withAllSubclassesDo:.
The test now does a little more than it used to do but it also applies a
check that should only be run between two *different* classes (i.e., the
subclass and its superclass) to the *same* classes (the superclass and
itself). To fix it, change
ClassBuilder>>validateSubclass:canKeepLayoutFrom:forSubclassFormat: to
have a line saying:
subclass == oldClass ifTrue:[^true]. "this ain't no subclass"
Please file a mantis bug for this problem.
> Another funny thing that i found, that you can actually do:
>
> | string |
> string := 'Blabla'.
> Object subclass: string
> instanceVariableNames: ''
> classVariableNames: ''
> poolDictionaries: ''
> category: 'Whatever'.
>
> Smalltalk at: string " returns a class you just defined."
Yeah, I'd say that's another bug. Somewhere there needs to be an
#asSymbol in the middle. Can you file another bug for this?
Cheers,
- Andreas
More information about the Squeak-dev
mailing list
|