<div id="__MailbirdStyleContent" style="font-size: 12pt;font-family: calibri;color: #000000">
                                        
                                        
                                            
                                        
                                        
                                        Hi, there.<div><br></div><div>I think the issue is that you cannot implement the message #or: for any domain object because the compiler treats it in a special way.</div><div><br></div><div>Consider a class Foo with the method #or:</div><div><br></div><div>Foo >> #or: block</div><div>   ^ block value</div><div><br></div><div>You cannot use it as expected:</div><div><br></div><div>x := Foo new.</div><div>y := x or: [42].</div><div><br></div><div>There is an optimisation that interferes with the general concepts of objects and messaging.</div><div><br></div><div>Best,</div><div>Marcel</div><div class="mb_sig"></div>
                                        
                                        <blockquote class="history_container" type="cite" style="border-left-style: solid;border-width: 1px;margin-top: 20px;margin-left: 0px;padding-left: 10px;min-width: 500px">
                        <p style="color: #AAAAAA; margin-top: 10px;">Am 10.09.2017 14:45:31 schrieb David T. Lewis <lewis@mail.msen.com>:</p>On Sun, Sep 10, 2017 at 01:33:15PM +0200, Lorenz K??hl wrote:<br>> I don't understand why Smalltalk doesn't allow me to have an or:<br>> method that takes a block argument (except on Boolean). For example:<br>> <br>> Set or: 1. ==> MNU as expected.<br>> <br>> Set or: [1]. ==> NonBooleanReceiver exception.<br>> <br>> Set or: [:x | x] ==> Argument has too many arguments<br>> <br>> Is it because the compiler specializes this to boolean when it sees<br>> the or: [ ... ] syntax? Is this a tradeoff made for performance?<br><br><br>Hi Lorenz,<br><br>If you are looking for set operations, check these methods:<br><br>  Collection>>union:<br>  Collection>>intersection:<br>  Collection>>difference:<br><br>I am not sure what you are trying to do with your examples. Can you<br>explain the intent?<br><br>Dave<br><br>_______________________________________________<br>Beginners mailing list<br>Beginners@lists.squeakfoundation.org<br>http://lists.squeakfoundation.org/mailman/listinfo/beginners<br>
                        </blockquote></div>