!Number class methodsFor: 'converting'!
asNumber
"Let someone ask for a number as a number"
^self
!
...or has this already been done?
Well, indeed it's already there in 2.2 :-)
But your method should look like
!Number methodsFor: 'converting'!
because it is not a class method.
You can test whether it is implemented with
Number canUnderstand: #asNumber
because #respondsTo: checks if the object knows about a message, while
#canUnderstand: checks whether the *instances* of the objects can answer
it. So an alternative would be (not that it makes much sense...)
Number new respondsTo: #asNumber
Regards,
Paolo
_______________________________________________
help-smalltalk mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-smalltalk