<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: What&#8217;s a Binary Selector?</title>
	<atom:link href="http://blog.3plus4.org/2007/05/06/whats-a-binary-selector/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.3plus4.org/2007/05/06/whats-a-binary-selector/</link>
	<description>The neighbourhood of 7</description>
	<pubDate>Sat, 19 Jul 2008 08:03:41 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>By: Paolo Bonzini</title>
		<link>http://blog.3plus4.org/2007/05/06/whats-a-binary-selector/#comment-272</link>
		<dc:creator>Paolo Bonzini</dc:creator>
		<pubDate>Fri, 29 Jun 2007 15:10:50 +0000</pubDate>
		<guid isPermaLink="false">http://blog.3plus4.org/2007/05/06/whats-a-binary-selector/#comment-272</guid>
		<description>I recently added (and the users appreciated it) a Python-like #% operator to strings:

   '%1 %2' % { 'Hello'. 'world' } =&#62; 'Hello world'
   '

Note a subtle difference between '' and String new.  The former is read-only, the latter is not.  One case where this is important, is when #become: enters the scene.  For example you can have a proxy object like

  Proxy class&#62;&#62;on: aBlock
    ^self basicNew set__Block: aBlock

  Proxy&#62;&#62;set__Block: aBlock
    block := aBlock

  Proxy&#62;&#62;doesNotUnderstand: aMessage
    [ block value become: self.  "assumes two-way become!" ]
        on: Error do: [ :ex &#124; ex pass. ^self ].
    ^self perform: aMessage

then, only "Proxy on: [ String new ]" will work.  Either of "Proxy on: [ '' ]" or "Proxy on: [ 3 ]" won't work.  Indeed, you better put that exception handler or bad usage will lock up the system.  Of course, this is made up, but you got the idea.

Also interesting is "(p := Proxy on: [ p ]) foo", which will nicely halt the system.  :-)</description>
		<content:encoded><![CDATA[<p>I recently added (and the users appreciated it) a Python-like #% operator to strings:</p>
<p>   &#8216;%1 %2&#8242; % { &#8216;Hello&#8217;. &#8216;world&#8217; } =&gt; &#8216;Hello world&#8217;<br />
   &#8216;</p>
<p>Note a subtle difference between &#8221; and String new.  The former is read-only, the latter is not.  One case where this is important, is when #become: enters the scene.  For example you can have a proxy object like</p>
<p>  Proxy class&gt;&gt;on: aBlock<br />
    ^self basicNew set__Block: aBlock</p>
<p>  Proxy&gt;&gt;set__Block: aBlock<br />
    block := aBlock</p>
<p>  Proxy&gt;&gt;doesNotUnderstand: aMessage<br />
    [ block value become: self.  "assumes two-way become!" ]<br />
        on: Error do: [ :ex | ex pass. ^self ].<br />
    ^self perform: aMessage</p>
<p>then, only &#8220;Proxy on: [ String new ]&#8221; will work.  Either of &#8220;Proxy on: [ '' ]&#8221; or &#8220;Proxy on: [ 3 ]&#8221; won&#8217;t work.  Indeed, you better put that exception handler or bad usage will lock up the system.  Of course, this is made up, but you got the idea.</p>
<p>Also interesting is &#8220;(p := Proxy on: [ p ]) foo&#8221;, which will nicely halt the system.  :-)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alexander Lazarević</title>
		<link>http://blog.3plus4.org/2007/05/06/whats-a-binary-selector/#comment-79</link>
		<dc:creator>Alexander Lazarević</dc:creator>
		<pubDate>Mon, 14 May 2007 18:01:36 +0000</pubDate>
		<guid isPermaLink="false">http://blog.3plus4.org/2007/05/06/whats-a-binary-selector/#comment-79</guid>
		<description>I got used to x@y, but I also favor "String new" over the empty string ''.
I also tend to use "Character space" instead of "$ ", which does not read well in cascades or with a . at the end</description>
		<content:encoded><![CDATA[<p>I got used to x@y, but I also favor &#8220;String new&#8221; over the empty string &#8221;.<br />
I also tend to use &#8220;Character space&#8221; instead of &#8220;$ &#8220;, which does not read well in cascades or with a . at the end</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter William Lount</title>
		<link>http://blog.3plus4.org/2007/05/06/whats-a-binary-selector/#comment-68</link>
		<dc:creator>Peter William Lount</dc:creator>
		<pubDate>Wed, 09 May 2007 23:57:57 +0000</pubDate>
		<guid isPermaLink="false">http://blog.3plus4.org/2007/05/06/whats-a-binary-selector/#comment-68</guid>
		<description>Yeah, for clarity I've stopped using "@" for the creation of points using keyword methods instead. For example instead of:

100 @ 50

I make use of

Point x: 100 y: 50.

Yes, it's much more verbose but it's very clear. To me clarity is more important than brevity via cryptic symbols.

I also now use "String new" rather than the empty string, ''. Again for clarity but also to avoid any confusion about which instance is being referred to.</description>
		<content:encoded><![CDATA[<p>Yeah, for clarity I&#8217;ve stopped using &#8220;@&#8221; for the creation of points using keyword methods instead. For example instead of:</p>
<p>100 @ 50</p>
<p>I make use of</p>
<p>Point x: 100 y: 50.</p>
<p>Yes, it&#8217;s much more verbose but it&#8217;s very clear. To me clarity is more important than brevity via cryptic symbols.</p>
<p>I also now use &#8220;String new&#8221; rather than the empty string, &#8221;. Again for clarity but also to avoid any confusion about which instance is being referred to.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alexander Lazarević</title>
		<link>http://blog.3plus4.org/2007/05/06/whats-a-binary-selector/#comment-66</link>
		<dc:creator>Alexander Lazarević</dc:creator>
		<pubDate>Wed, 09 May 2007 07:47:47 +0000</pubDate>
		<guid isPermaLink="false">http://blog.3plus4.org/2007/05/06/whats-a-binary-selector/#comment-66</guid>
		<description>I think that binary operators are too ambiguous most of the time. Even if you have very basic objects like vectors in a vector space you use dot: or cross: to make clear which product operation you want to perform.
If you use binary math operators you have to deal with the expectation, that  they "work" the same like they do with numbers. I at least would stumble over implementations of + where commutativity is not given. (I guess there are even numerical examples where a+b=b+a is false, but that does not change my expectation! :)</description>
		<content:encoded><![CDATA[<p>I think that binary operators are too ambiguous most of the time. Even if you have very basic objects like vectors in a vector space you use dot: or cross: to make clear which product operation you want to perform.<br />
If you use binary math operators you have to deal with the expectation, that  they &#8220;work&#8221; the same like they do with numbers. I at least would stumble over implementations of + where commutativity is not given. (I guess there are even numerical examples where a+b=b+a is false, but that does not change my expectation! :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter William Lount</title>
		<link>http://blog.3plus4.org/2007/05/06/whats-a-binary-selector/#comment-65</link>
		<dc:creator>Peter William Lount</dc:creator>
		<pubDate>Wed, 09 May 2007 03:58:43 +0000</pubDate>
		<guid isPermaLink="false">http://blog.3plus4.org/2007/05/06/whats-a-binary-selector/#comment-65</guid>
		<description>Beware of moving Smalltalk towards &lt;a href="http://smalltalk.org/articles/article_20040914_a1.html" rel="nofollow"&gt;PERL&lt;/a&gt;.</description>
		<content:encoded><![CDATA[<p>Beware of moving Smalltalk towards <a href="http://smalltalk.org/articles/article_20040914_a1.html" rel="nofollow">PERL</a>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: nicolas cellier</title>
		<link>http://blog.3plus4.org/2007/05/06/whats-a-binary-selector/#comment-62</link>
		<dc:creator>nicolas cellier</dc:creator>
		<pubDate>Mon, 07 May 2007 07:33:43 +0000</pubDate>
		<guid isPermaLink="false">http://blog.3plus4.org/2007/05/06/whats-a-binary-selector/#comment-62</guid>
		<description>Note that the minus case has to do with semantics of separators
see http://bugs.squeak.org/view.php?id=3616</description>
		<content:encoded><![CDATA[<p>Note that the minus case has to do with semantics of separators<br />
see <a href="http://bugs.squeak.org/view.php?id=3616" rel="nofollow">http://bugs.squeak.org/view.php?id=3616</a></p>
]]></content:encoded>
	</item>
</channel>
</rss>
