Hello
Is there a simpler way of writing
Character class selectors includes: #cr
(= test if Character class has method #cr)
--Hannes
Am 2012-04-28 um 00:45 schrieb H. Hirzel:
Hello
Is there a simpler way of writing
Character class selectors includes: #cr
(= test if Character class has method #cr)
Character canUnderstand: #cr
remember, its messages, => ('a' respondsTo: #first) == (String canUnderstand: #first)
:)
Best -Tobias
(resend, wrong from: mail) Am 2012-04-28 um 01:01 schrieb Tobias Pape:
Am 2012-04-28 um 00:45 schrieb H. Hirzel:
Hello
Is there a simpler way of writing
Character class selectors includes: #cr
(= test if Character class has method #cr)
Character canUnderstand: #cr
remember, its messages, => ('a' respondsTo: #first) == (String canUnderstand: #first)
Unless, of course, you really wanted to know whether
Character class
knows about #cr. But bear in mind, Character class is not the “class side” of Character but the Metaclass of Character
Character class isKindOf: Metaclass "=> true"
The “class side” of Character is simply Character
Character isKindOf: Class "=> true"
The “instance side” of Character is, you know it, a character itself
$a isKindOf: Character "=> true"
==
So, if you want to know whether the “class side” of Character knows of the method #cr, the correct one is:
Character respondsTo: #cr
HTH
Best -Tobias
Hi Hannes,
HH> Is there a simpler way of writing
HH> Character class selectors includes: #cr
Character respondsTo: #cr
Cheers,
Herbert
Thank you Tobias and Herbert for the answers
Interestingly
Squeak 4.3 -------------- ('a' respondsTo: #first) == (String canUnderstand: #first) evaluates to true
(Character respondsTo: #cr) == (Character canUnderstand: #cr) evaluates to false
Pharo 1.4 ----------- the same as Squeak
Cuis 4.0 --------- true in both cases.
--Hannes
On 4/28/12, Herbert König herbertkoenig@gmx.net wrote:
Hi Hannes,
HH> Is there a simpler way of writing
HH> Character class selectors includes: #cr
Character respondsTo: #cr
Cheers,
Herbert
Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Am 2012-04-28 um 01:35 schrieb H. Hirzel:
Thank you Tobias and Herbert for the answers
Interestingly
Squeak 4.3
('a' respondsTo: #first) == (String canUnderstand: #first) evaluates to true
(Character respondsTo: #cr) == (Character canUnderstand: #cr) evaluates to false
Pharo 1.4
the same as Squeak
Cuis 4.0
true in both cases.
Then in Cuis you can either do
Character class cr
Or Character does not understand #cr
Right?
Best -Tobias
beginners@lists.squeakfoundation.org