Hi Denis, On Tue, May 9, 2017 at 12:51 PM, Denis Kudriashov <dionisiydk@gmail.com> wrote:
Hi Eliot.
2017-05-09 21:27 GMT+02:00 Eliot Miranda <eliot.miranda@gmail.com>:
Hmmm, classNamed: has always answered nil for nonexistent classes. Did this get changed? Not sure that's right. Why not add checkedClassNamed: or some such?
I created this issue. I am sure that returning nil from methods is always bad design and many books describe it. Also it is not consistent to #at: method:
Smalltalk globals at: #AbsentClass. "=> raise error" Smalltalk globals classNamed: #AbsentClass "=> nil"
I get that. But there's lots of code out there that expects classNamed: to answer nil for names tat don't name a class. Why break all that code? If you had added checkedClassNamed: or some thing else then that old code wouldn't be broken. There needs to be some cheap way of checking whether a class with a specific name actually exists. classNamed: fulfilled that need. By redefining it you'e meant that that has to be reimplemented. It's not a good idea to redefine co=re behavior in this way. It breaks lots of code (including VMMaker). -- _,,,^..^,,,_ best, Eliot