The Trunk: Kernel-nice.1126.mcz

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

The Trunk: Kernel-nice.1126.mcz

Nicolas Cellier uploaded a new version of Kernel to project The Trunk:

==================== Summary ====================

Name: Kernel-nice.1126
Author: nice
Time: 30 November 2017, 11:19:00.113675 pm
UUID: f617f2e1-6bc6-4db5-b53e-a6136a180c63
Ancestors: Kernel-pre.1125

Introduce Class>>isAbstract for use with initializedInstance.

Abstract classes are not expected to have any initializedInstance and will answer nil instead.

It is subclassResponsibility to declare if isAbstract, default is false, most classes are concrete.

We do not try to be clever and scan all methods sending subclassResponsibility, because failing to fullfill some responsibility does not make a class abstract, it just makes it imperfect!

Note that isAbstract may have other smart usage (maybe special presentation in the browser etc...)

=============== Diff against Kernel-pre.1125 ===============

Item was added:
+ ----- Method: Boolean class>>isAbstract (in category 'testing') -----
+ isAbstract
+ ^self = Boolean!

Item was added:
+ ----- Method: Class>>isAbstract (in category 'testing') -----
+ isAbstract
+ "Answer true if I am to be considered an abstract class.
+ An abstract class shall better not be instantiated.
+ Or its instances may miss some important behavior.
+ Typically, a class with methods sending #subclassResponsibility might be considered abstract.
+ But we can't erect this as a general rule, it might be that the message is never sent.
+ By default, all classes are concrete, up to each one to declare itself abstract."
+ ^false!

Item was added:
+ ----- Method: CompiledCode class>>initializedInstance (in category 'instance creation') -----
+ initializedInstance
+ "Don't even think of it.
+ This low level machinery is not for general use."
+ ^nil!

Item was changed:
  ----- Method: Object class>>initializedInstance (in category 'instance creation') -----
+ self isAbstract ifTrue: [^nil].
  ^ self new!