On Mon, Nov 9, 2015 at 8:59 PM, Thierry Goubier <thierry.goubier@gmail.com> wrote:
2015-11-09 13:37 GMT+01:00 Sean P. DeNigris <sean@clipperadams.com>:
Thierry Goubier wrote
Are you sure it would eliminate the gotcha? Can't you trigger it again with self classname: 1?
By "gotcha" I mean specifically doing something that seems normal that unknowningly breaks the system, added by the extra pain in this case that you might not find out until much later and not be able to connect the cause.
If someone sends #classname:, or even assigns to #classname, they deserve a broken system ;)
Thierry Goubier wrote
I like the elegance of AClass name.
Yes it's nice, but IMHO as a tremendous price. This is a constant pain point for newbies.
Come on; just an assert: aString isString in #name: would certainly stop the student doing any harm.
The fix was given as...
To restore the system: class instVarNamed: #name put: #MyClass.
So should the assert be isSymbol? or are symbol/string interchangeable in this context? Also, before restoring the system... (Smalltalk at: #MyClass) name --> 1 so do we want to ensure the Smalltalk collection is synchronised? Perhaps this is a slots use case for a First Class Relationship [1] ? [1] https://hal.inria.fr/hal-00641716/file/Verw11b-OOSPLA11-FlexibleObjectLayout... cheers -ben