[Newbies] Polymorphic or: with block argument
Lorenz Köhl
rainbowtwigs at gmail.com
Sun Sep 10 11:33:15 UTC 2017
I don't understand why Smalltalk doesn't allow me to have an or:
method that takes a block argument (except on Boolean). For example:
Set or: 1. ==> MNU as expected.
Set or: [1]. ==> NonBooleanReceiver exception.
Set or: [:x | x] ==> Argument has too many arguments
Is it because the compiler specializes this to boolean when it sees
the or: [ ... ] syntax? Is this a tradeoff made for performance?
greetings,
Lorenz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/beginners/attachments/20170910/be1db534/attachment.html>
More information about the Beginners
mailing list