[Pharo-project] Class>>isSystemDefined ?
Dear List members, The following method is defined in Class: -=-=-=-=-=-=-=-=-= Class>>isSystemDefined "Answer true if the receiver is a system-defined class, and not a UniClass (an instance-specific lightweight class)" ^ self == self officialClass -=-=-=-=-=-=-=-=-= isSystemDefined is sent a number of times. Especially by streams. I guess that this determines what should be serialized what should not. However, #officialClass has only two implementers: -=-=-=-=-=-=-=-=-= Class>>officialClass "I am not a UniClass. (See Player officialClass). Return the class you use to make new subclasses." ^ self -=-=-=-=-=-=-=-=-= And slightly more surprising: -=-=-=-=-=-=-=-=-= MorphicModel>>officialClass "We want to make a new instance of the receiver, which is a subclass of MorphicModel. Answer who to make a new subclass of. Also used to tell if a given class is a UniClass, existing only for its single instance." ^ self name last isDigit ifTrue: [MorphicModel] ifFalse: [self] "MorphicModel7 can not have subclasses, but Slider and SystemWindow may" -=-=-=-=-=-=-=-=-= There is a very strong smell for cleaning here. Apparently, most of usage of #isSystemDefined could be replaced by #isBehavior Cheers, Alexandre -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
Sounds a lot to me like something that could be a leftover from Etoys, f.ex. used to support auto-numbered, auto-generated morphs by a user, but avoid saving them to disk etc.´... Cheers, Henry On Aug 11, 2009, at 4:04 01PM, Alexandre Bergel wrote:
Dear List members,
The following method is defined in Class: -=-=-=-=-=-=-=-=-= Class>>isSystemDefined "Answer true if the receiver is a system-defined class, and not a UniClass (an instance-specific lightweight class)"
^ self == self officialClass -=-=-=-=-=-=-=-=-=
isSystemDefined is sent a number of times. Especially by streams. I guess that this determines what should be serialized what should not.
However, #officialClass has only two implementers:
-=-=-=-=-=-=-=-=-= Class>>officialClass "I am not a UniClass. (See Player officialClass). Return the class you use to make new subclasses."
^ self -=-=-=-=-=-=-=-=-=
And slightly more surprising:
-=-=-=-=-=-=-=-=-= MorphicModel>>officialClass "We want to make a new instance of the receiver, which is a subclass of MorphicModel. Answer who to make a new subclass of. Also used to tell if a given class is a UniClass, existing only for its single instance."
^ self name last isDigit ifTrue: [MorphicModel] ifFalse: [self] "MorphicModel7 can not have subclasses, but Slider and SystemWindow may" -=-=-=-=-=-=-=-=-=
There is a very strong smell for cleaning here. Apparently, most of usage of #isSystemDefined could be replaced by #isBehavior
Cheers, Alexandre -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Indeed. So, is this a good candidate for more cleaning? If yes, I add an entry in the wiki and I work on it now. Alexandre On 11 Aug 2009, at 10:40, Henrik Johansen wrote:
Sounds a lot to me like something that could be a leftover from Etoys, f.ex. used to support auto-numbered, auto-generated morphs by a user, but avoid saving them to disk etc.´...
Cheers, Henry
On Aug 11, 2009, at 4:04 01PM, Alexandre Bergel wrote:
Dear List members,
The following method is defined in Class: -=-=-=-=-=-=-=-=-= Class>>isSystemDefined "Answer true if the receiver is a system-defined class, and not a UniClass (an instance-specific lightweight class)"
^ self == self officialClass -=-=-=-=-=-=-=-=-=
isSystemDefined is sent a number of times. Especially by streams. I guess that this determines what should be serialized what should not.
However, #officialClass has only two implementers:
-=-=-=-=-=-=-=-=-= Class>>officialClass "I am not a UniClass. (See Player officialClass). Return the class you use to make new subclasses."
^ self -=-=-=-=-=-=-=-=-=
And slightly more surprising:
-=-=-=-=-=-=-=-=-= MorphicModel>>officialClass "We want to make a new instance of the receiver, which is a subclass of MorphicModel. Answer who to make a new subclass of. Also used to tell if a given class is a UniClass, existing only for its single instance."
^ self name last isDigit ifTrue: [MorphicModel] ifFalse: [self] "MorphicModel7 can not have subclasses, but Slider and SystemWindow may" -=-=-=-=-=-=-=-=-=
There is a very strong smell for cleaning here. Apparently, most of usage of #isSystemDefined could be replaced by #isBehavior
Cheers, Alexandre -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
Seeing as how isSystemDefined is only false for subclasses of MorphicModel that ends in a number, I'd say so :) Making a version of Etoys which runs on Pharo would be more difficult to achieve though. My 2c: Possibly forcing a rethinking of how to avoid saving auto- generated classes without hacking it into core methods, can't really be seen as a bad thing anyways... Cheers, Henry On Aug 11, 2009, at 4:44 48PM, Alexandre Bergel wrote:
Indeed. So, is this a good candidate for more cleaning? If yes, I add an entry in the wiki and I work on it now.
Alexandre
On 11 Aug 2009, at 10:40, Henrik Johansen wrote:
Sounds a lot to me like something that could be a leftover from Etoys, f.ex. used to support auto-numbered, auto-generated morphs by a user, but avoid saving them to disk etc.´...
Cheers, Henry
On Aug 11, 2009, at 4:04 01PM, Alexandre Bergel wrote:
Dear List members,
The following method is defined in Class: -=-=-=-=-=-=-=-=-= Class>>isSystemDefined "Answer true if the receiver is a system-defined class, and not a UniClass (an instance-specific lightweight class)"
^ self == self officialClass -=-=-=-=-=-=-=-=-=
isSystemDefined is sent a number of times. Especially by streams. I guess that this determines what should be serialized what should not.
However, #officialClass has only two implementers:
-=-=-=-=-=-=-=-=-= Class>>officialClass "I am not a UniClass. (See Player officialClass). Return the class you use to make new subclasses."
^ self -=-=-=-=-=-=-=-=-=
And slightly more surprising:
-=-=-=-=-=-=-=-=-= MorphicModel>>officialClass "We want to make a new instance of the receiver, which is a subclass of MorphicModel. Answer who to make a new subclass of. Also used to tell if a given class is a UniClass, existing only for its single instance."
^ self name last isDigit ifTrue: [MorphicModel] ifFalse: [self] "MorphicModel7 can not have subclasses, but Slider and SystemWindow may" -=-=-=-=-=-=-=-=-=
There is a very strong smell for cleaning here. Apparently, most of usage of #isSystemDefined could be replaced by #isBehavior
Cheers, Alexandre -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
On 11.08.2009, at 11:03, Henrik Johansen wrote:
Seeing as how isSystemDefined is only false for subclasses of MorphicModel that ends in a number, I'd say so :)
Making a version of Etoys which runs on Pharo would be more difficult to achieve though.
Any version of etoys running on top of Pharo of course would have a better design for anonymous behaviors than that ugly hack... Marcus -- Marcus Denker - http://marcusdenker.de PLEIAD Lab - Computer Science Department (DCC) - University of Chile
2009/8/11 Henrik Johansen <henrik.s.johansen@veloxit.no>:
Seeing as how isSystemDefined is only false for subclasses of MorphicModel that ends in a number, I'd say so :)
Making a version of Etoys which runs on Pharo would be more difficult to achieve though.
My 2c: Possibly forcing a rethinking of how to avoid saving auto- generated classes without hacking it into core methods, can't really be seen as a bad thing anyways...
Don't ask, tell. (c) instead asking #isSystemDefined, tell class to (or not to) serialize self..
Cheers, Henry
On Aug 11, 2009, at 4:44 48PM, Alexandre Bergel wrote:
Indeed. So, is this a good candidate for more cleaning? If yes, I add an entry in the wiki and I work on it now.
Alexandre
On 11 Aug 2009, at 10:40, Henrik Johansen wrote:
Sounds a lot to me like something that could be a leftover from Etoys, f.ex. used to support auto-numbered, auto-generated morphs by a user, but avoid saving them to disk etc.´...
Cheers, Henry
On Aug 11, 2009, at 4:04 01PM, Alexandre Bergel wrote:
Dear List members,
The following method is defined in Class: -=-=-=-=-=-=-=-=-= Class>>isSystemDefined   "Answer true if the receiver is a system-defined class, and not a UniClass (an instance-specific lightweight class)"
  ^ self == self officialClass -=-=-=-=-=-=-=-=-=
isSystemDefined is sent a number of times. Especially by streams. I guess that this determines what should be serialized what should not.
However, #officialClass has only two implementers:
-=-=-=-=-=-=-=-=-= Class>>officialClass   "I am not a UniClass.  (See Player officialClass).  Return the class you use to make new subclasses."
  ^ self -=-=-=-=-=-=-=-=-=
And slightly more surprising:
-=-=-=-=-=-=-=-=-= MorphicModel>>officialClass   "We want to make a new instance of the receiver, which is a subclass of MorphicModel.  Answer who to make a new subclass of.  Also used to tell if a given class is a UniClass, existing only for its single instance."
  ^ self name last isDigit ifTrue: [MorphicModel] ifFalse: [self]       "MorphicModel7 can not have subclasses, but Slider and SystemWindow may" -=-=-=-=-=-=-=-=-=
There is a very strong smell for cleaning here. Apparently, most of usage of #isSystemDefined could be replaced by #isBehavior
Cheers, Alexandre -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel  http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel  http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
-- Best regards, Igor Stasenko AKA sig.
We should probably remove the isSystemDefined and officialClass but we should do it with care because etoys crept really deep. Stef On Aug 11, 2009, at 4:04 PM, Alexandre Bergel wrote:
Dear List members,
The following method is defined in Class: -=-=-=-=-=-=-=-=-= Class>>isSystemDefined "Answer true if the receiver is a system-defined class, and not a UniClass (an instance-specific lightweight class)"
^ self == self officialClass -=-=-=-=-=-=-=-=-=
isSystemDefined is sent a number of times. Especially by streams. I guess that this determines what should be serialized what should not.
However, #officialClass has only two implementers:
-=-=-=-=-=-=-=-=-= Class>>officialClass "I am not a UniClass. (See Player officialClass). Return the class you use to make new subclasses."
^ self -=-=-=-=-=-=-=-=-=
And slightly more surprising:
-=-=-=-=-=-=-=-=-= MorphicModel>>officialClass "We want to make a new instance of the receiver, which is a subclass of MorphicModel. Answer who to make a new subclass of. Also used to tell if a given class is a UniClass, existing only for its single instance."
^ self name last isDigit ifTrue: [MorphicModel] ifFalse: [self] "MorphicModel7 can not have subclasses, but Slider and SystemWindow may" -=-=-=-=-=-=-=-=-=
There is a very strong smell for cleaning here. Apparently, most of usage of #isSystemDefined could be replaced by #isBehavior
Cheers, Alexandre -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
did you got a cs for fixing that? Else could you just log that as a bug entry for 1.1 Stef On Aug 11, 2009, at 4:04 PM, Alexandre Bergel wrote:
Dear List members,
The following method is defined in Class: -=-=-=-=-=-=-=-=-= Class>>isSystemDefined "Answer true if the receiver is a system-defined class, and not a UniClass (an instance-specific lightweight class)"
^ self == self officialClass -=-=-=-=-=-=-=-=-=
isSystemDefined is sent a number of times. Especially by streams. I guess that this determines what should be serialized what should not.
However, #officialClass has only two implementers:
-=-=-=-=-=-=-=-=-= Class>>officialClass "I am not a UniClass. (See Player officialClass). Return the class you use to make new subclasses."
^ self -=-=-=-=-=-=-=-=-=
And slightly more surprising:
-=-=-=-=-=-=-=-=-= MorphicModel>>officialClass "We want to make a new instance of the receiver, which is a subclass of MorphicModel. Answer who to make a new subclass of. Also used to tell if a given class is a UniClass, existing only for its single instance."
^ self name last isDigit ifTrue: [MorphicModel] ifFalse: [self] "MorphicModel7 can not have subclasses, but Slider and SystemWindow may" -=-=-=-=-=-=-=-=-=
There is a very strong smell for cleaning here. Apparently, most of usage of #isSystemDefined could be replaced by #isBehavior
Cheers, Alexandre -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
officialClass and isSystemDefined are two unnecessary methods. The .cs attached to this issue remove these methods and take care of the callers. I added an entry to the google code website and I provide a change set file to clean. #1075 http://code.google.com/p/pharo/issues/detail?id=1075 The following demonstrates that no impact is expected from loading the clean. In a fresh 10401, the method #isSystemDefined always return true. To be convinced: (Smalltalk allClasses select: [:cls | cls isSystemDefined not]) isEmpty => true (Smalltalk allClasses select: [:cls | cls class isSystemDefined not]) isEmpty => true This is normal, since isSystemDefined is defined as follows: -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Class>>isSystemDefined "Answer true if the receiver is a system-defined class, and not a UniClass (an instance- specific lightweight class)" ^ self == self officialClass MetaClass>>isSystemDefined "Answer false if I am a UniClass (an instance-specific lightweight class)" ^ true Class>>officialClass "I am not a UniClass. (See Player officialClass). Return the class you use to make new subclasses." ^ self MetaClass>>officialClass "We want to make a new instance of the receiver, which is a subclass of MorphicModel. Answer who to make a new subclass of. Also used to tell if a given class is a UniClass, existing only for its single instance." ^ self name last isDigit ifTrue: [MorphicModel] ifFalse: [self] "MorphicModel7 can not have subclasses, but Slider and SystemWindow may" -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= When #officialClass is sent to a class, the receiver is always returned. (MorphicModel allSubclasses select: [:cls | cls name last isDigit]) isEmpty => true Before loading the clean, in a fresh 10410 you had: 7124 run, 7102 passes, 4 expected failures, 16 failures, 2 errors, 0 unexpected passes These figures do not change after having loaded the clean. Cheers, Alexandre On 18 Aug 2009, at 16:52, Stéphane Ducasse wrote:
did you got a cs for fixing that? Else could you just log that as a bug entry for 1.1 Stef
On Aug 11, 2009, at 4:04 PM, Alexandre Bergel wrote:
Dear List members,
The following method is defined in Class: -=-=-=-=-=-=-=-=-= Class>>isSystemDefined "Answer true if the receiver is a system-defined class, and not a UniClass (an instance-specific lightweight class)"
^ self == self officialClass -=-=-=-=-=-=-=-=-=
isSystemDefined is sent a number of times. Especially by streams. I guess that this determines what should be serialized what should not.
However, #officialClass has only two implementers:
-=-=-=-=-=-=-=-=-= Class>>officialClass "I am not a UniClass. (See Player officialClass). Return the class you use to make new subclasses."
^ self -=-=-=-=-=-=-=-=-=
And slightly more surprising:
-=-=-=-=-=-=-=-=-= MorphicModel>>officialClass "We want to make a new instance of the receiver, which is a subclass of MorphicModel. Answer who to make a new subclass of. Also used to tell if a given class is a UniClass, existing only for its single instance."
^ self name last isDigit ifTrue: [MorphicModel] ifFalse: [self] "MorphicModel7 can not have subclasses, but Slider and SystemWindow may" -=-=-=-=-=-=-=-=-=
There is a very strong smell for cleaning here. Apparently, most of usage of #isSystemDefined could be replaced by #isBehavior
Cheers, Alexandre -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
participants (5)
-
Alexandre Bergel -
Henrik Johansen -
Igor Stasenko -
Marcus Denker -
Stéphane Ducasse