<?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"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: A Taste of Nested Classes, part 3</title>
	<atom:link href="http://blog.3plus4.org/2009/02/15/a-taste-of-nested-classes-part-3/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.3plus4.org/2009/02/15/a-taste-of-nested-classes-part-3/</link>
	<description>The neighbourhood of 7</description>
	<lastBuildDate>Mon, 28 Nov 2011 19:21:45 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Travis Griggs</title>
		<link>http://blog.3plus4.org/2009/02/15/a-taste-of-nested-classes-part-3/comment-page-1/#comment-1552</link>
		<dc:creator>Travis Griggs</dc:creator>
		<pubDate>Mon, 16 Feb 2009 07:31:43 +0000</pubDate>
		<guid isPermaLink="false">http://blog.3plus4.org/?p=118#comment-1552</guid>
		<description>But why do we not want to &quot;arrange for an explicit reference to the object that provides it?&quot; As you point out, sending it to &quot;self&quot; is a sort of misnomer. A (the?) point of object oriented programming is to bind behavior to data, and there&#039;s really no obvious connection between the &quot;self&quot; and the function. The CLOS guys get around this by just having generic functions. They have an OO system wouldn&#039;t be having this dilemma.

An alternative in Smalltalk is to just create a &quot;utility functions&quot; class. This leads to awkward things like SmalltalkWorkbench doSomething and SystemUtils do something else. And you have to locate and then code the long reference, which is not as simple/terse as just &#039;self&#039;. Probably my favorite &quot;simple solution&quot; to this, that I&#039;ve seen, without doing the more involved solution you lay out (which is of course appropriate for newspeak which wants to embrace the implicit receiver syntax), was the way Smalltalk/X did this. Smalltalk/X has nested classes. So it is common to have a &quot;namespace&quot; class for your application MyThing, and then put your classes in it (and in a package by the same name consequently). This is similar to VisualWorks, but unlike VisualWorks, this &quot;namespace&quot; is a first class Behavior, capable of defining methods/services appropriate for the application, rather than VW&#039;s cold/dead &quot;declarative&quot; namespaces. It&#039;s a rather cheap/simple/easy/cheesy solution, but I found what little I did with it, it worked very well. I would just add MyGame logError: aString messages to my code. This seemed more expressive anyway of using self as the receiver. It instantly identified the method for what it likely was.</description>
		<content:encoded><![CDATA[<p>But why do we not want to &#8220;arrange for an explicit reference to the object that provides it?&#8221; As you point out, sending it to &#8220;self&#8221; is a sort of misnomer. A (the?) point of object oriented programming is to bind behavior to data, and there&#8217;s really no obvious connection between the &#8220;self&#8221; and the function. The CLOS guys get around this by just having generic functions. They have an OO system wouldn&#8217;t be having this dilemma.</p>
<p>An alternative in Smalltalk is to just create a &#8220;utility functions&#8221; class. This leads to awkward things like SmalltalkWorkbench doSomething and SystemUtils do something else. And you have to locate and then code the long reference, which is not as simple/terse as just &#8216;self&#8217;. Probably my favorite &#8220;simple solution&#8221; to this, that I&#8217;ve seen, without doing the more involved solution you lay out (which is of course appropriate for newspeak which wants to embrace the implicit receiver syntax), was the way Smalltalk/X did this. Smalltalk/X has nested classes. So it is common to have a &#8220;namespace&#8221; class for your application MyThing, and then put your classes in it (and in a package by the same name consequently). This is similar to VisualWorks, but unlike VisualWorks, this &#8220;namespace&#8221; is a first class Behavior, capable of defining methods/services appropriate for the application, rather than VW&#8217;s cold/dead &#8220;declarative&#8221; namespaces. It&#8217;s a rather cheap/simple/easy/cheesy solution, but I found what little I did with it, it worked very well. I would just add MyGame logError: aString messages to my code. This seemed more expressive anyway of using self as the receiver. It instantly identified the method for what it likely was.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

