If the definition of abstraction is that one can't instantiate an
instance of the abstract class (I'm cribbing the definition of it here
a bit from Java/C#/etc where one can't instantiate abstract classes by
restriction in the language) then how about overriding #new on the
class side with an implementation which provides an exception from any
send to #new on that class and implement an #isAbstract that looks for
that exception?
That's of course assuming that non-instantiability is a desired
behaviour here. This could well be a bogus assumption on my part.
Cheers,
Simon
On 6 Oct 2008, at 07:18, Stéphane Ducasse wrote:
this is why there is a or in my expression and this is why I still
would like to have a way to declare a class as abstract even if it
does not have abstract methods.
stef
On Oct 5, 2008, at 11:34 PM, Alexandre Bergel wrote:
A class is said to be abstract if its not reasonable to instantiate
it. An abstract class may perfectly have no abstract method.
Cheers,
Alexandre
On 5 Oct 2008, at 11:49, Stéphane Ducasse wrote:
I would really like to have a way to specify that a class is
abstract.
For example I would like to be able to write a test as follow
self assert: (Collection allSubclasses reject: [:each
each isAbstract ]) new isEmpty
now saying that isAbstract is if a class has one method sending
subclassResponsibility is not
really good for me.
May be we could have something like
isAbstract
^ self declaredAsAbstract
or: [ (self whichSelectorsReferToSymbol:
#subclassResponsibility) isEmpty not]
Stef
_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
******************************************************************************************************************************************
This email is from Pinesoft Limited. Its contents are confidential to the
intended recipient(s) at the email address(es) to which it has been addressed.
It may not be disclosed to or used by anyone other than the addressee(s), nor
may it be copied in anyway. If received in error, please contact the sender,
then delete it from your system. Although this email and attachments are
believed to be free of virus, or any other defect which might affect any
computer or IT system into which they are received and opened, it is the
responsibility of the recipient to ensure that they are virus free and no
responsibility is accepted by Pinesoft for any loss or damage arising in any
way from receipt or use thereof.
*******************************************************************************************************************************************
Pinesoft Limited are registered in England, Registered number: 2914825.
Registered office: 266-268 High Street, Waltham Cross, Herts, EN8 7EA
_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project