- Dec 2023
-
cuis-smalltalk.github.io cuis-smalltalk.github.io
-
(13) When considering its parents, the combined method count is more than 300.
Number selectors size
vsNumber allSelectors size
-
Tip. In the workspace Ctrl-b (Browse) on the class name will open a Browser on the named class:
Programmatically you can send
#browseClassHierarchy
to any object -
How many methods are there in the arithmetic method category of the CharacterSequence class?
There are no messages categorized as arithmetic in String but in CharacterSequence, which String subclassifies. Squeak Strings on the other hand, implement arithmetic messages, exactly those mentioned in the solution to the exercise; Note however that
String allMethodsInCategory: #arithmetic
in both Cuis and Squeak include a seventh method#raisedTo:
because#allMethodsInCategory
also looks up for inherited methods from superclasses. Yes! you can raise the empty string to the power of n for n ∈ Number and the result is another empty string! WAT :) The fact that we can evaluate'' raisedTo: n
without error seems like an unforeseen consequence of#adaptToCollection:andSend:
relying on#collect
and how the latter works on empty collections.
-
- Sep 2021