<?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 2</title>
	<atom:link href="http://blog.3plus4.org/2008/12/07/a-taste-of-nested-classes-part-2/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.3plus4.org/2008/12/07/a-taste-of-nested-classes-part-2/</link>
	<description>The neighbourhood of 7</description>
	<lastBuildDate>Wed, 12 May 2010 16:29:09 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: bob</title>
		<link>http://blog.3plus4.org/2008/12/07/a-taste-of-nested-classes-part-2/comment-page-1/#comment-1482</link>
		<dc:creator>bob</dc:creator>
		<pubDate>Fri, 19 Dec 2008 15:32:55 +0000</pubDate>
		<guid isPermaLink="false">http://blog.3plus4.org/?p=97#comment-1482</guid>
		<description>Steve: I think Newspeak superclasses can be determined dynamically (a &quot;class-name&quot; reference is in fact a method call), but class containment structure is statically fixed. Not sure if the superclass resolution is routinely re-evaluated as part of method lookup, or just resolved once when the class definition is evaluated and thereafter frozen. Makes my brain hurt a bit, in a mostly good way ... so your point may be less valid in Newspeak than in some other languages.</description>
		<content:encoded><![CDATA[<p>Steve: I think Newspeak superclasses can be determined dynamically (a &#8220;class-name&#8221; reference is in fact a method call), but class containment structure is statically fixed. Not sure if the superclass resolution is routinely re-evaluated as part of method lookup, or just resolved once when the class definition is evaluated and thereafter frozen. Makes my brain hurt a bit, in a mostly good way &#8230; so your point may be less valid in Newspeak than in some other languages.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: steve</title>
		<link>http://blog.3plus4.org/2008/12/07/a-taste-of-nested-classes-part-2/comment-page-1/#comment-1467</link>
		<dc:creator>steve</dc:creator>
		<pubDate>Thu, 18 Dec 2008 18:18:21 +0000</pubDate>
		<guid isPermaLink="false">http://blog.3plus4.org/?p=97#comment-1467</guid>
		<description>That view of &quot;lexical&quot; seems suited to a primarily code-as-text world. But with IDEs that walk and present the underlying graph of objects in any number of suitable ways (hierarchy browser, traits browser) I am not sure how significant that is in terms of deciding tradeoffs. I do understand the API design angle, thanks.</description>
		<content:encoded><![CDATA[<p>That view of &#8220;lexical&#8221; seems suited to a primarily code-as-text world. But with IDEs that walk and present the underlying graph of objects in any number of suitable ways (hierarchy browser, traits browser) I am not sure how significant that is in terms of deciding tradeoffs. I do understand the API design angle, thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vassili Bykov</title>
		<link>http://blog.3plus4.org/2008/12/07/a-taste-of-nested-classes-part-2/comment-page-1/#comment-1394</link>
		<dc:creator>Vassili Bykov</dc:creator>
		<pubDate>Tue, 09 Dec 2008 05:14:44 +0000</pubDate>
		<guid isPermaLink="false">http://blog.3plus4.org/?p=97#comment-1394</guid>
		<description>Steve:

&quot;Lexical&quot; refers to relationships established by the structure of the source code. An inner class definition is contained in an outer class definition, so things in the outer class are called lexically visible from the inner class. In contrast, the superclass is only a reference in the source.

Yes, moving an outer class method to a superclass may indeed cause a behavior change, so strictly speaking in Newspeak such a transformation is not a refactoring.

The choice between implicit or explicit sends is essentially a question of API design. In a nutshell I&#039;d say you design a module so that certain names are used within it to refer to certain things, and those are sent implicitly. I hope the next part will clarify this.

Danil:

No, that&#039;s not something that class nesting is supposed to handle. Recursive structures can be created by simple object composition. Arbitrary depth, or varying composition patterns, or migration to different containers Bob suggested are all signs that the relationship between the classes is too &quot;fluid&quot; to consider one of them nested in another.</description>
		<content:encoded><![CDATA[<p>Steve:</p>
<p>&#8220;Lexical&#8221; refers to relationships established by the structure of the source code. An inner class definition is contained in an outer class definition, so things in the outer class are called lexically visible from the inner class. In contrast, the superclass is only a reference in the source.</p>
<p>Yes, moving an outer class method to a superclass may indeed cause a behavior change, so strictly speaking in Newspeak such a transformation is not a refactoring.</p>
<p>The choice between implicit or explicit sends is essentially a question of API design. In a nutshell I&#8217;d say you design a module so that certain names are used within it to refer to certain things, and those are sent implicitly. I hope the next part will clarify this.</p>
<p>Danil:</p>
<p>No, that&#8217;s not something that class nesting is supposed to handle. Recursive structures can be created by simple object composition. Arbitrary depth, or varying composition patterns, or migration to different containers Bob suggested are all signs that the relationship between the classes is too &#8220;fluid&#8221; to consider one of them nested in another.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: steve</title>
		<link>http://blog.3plus4.org/2008/12/07/a-taste-of-nested-classes-part-2/comment-page-1/#comment-1380</link>
		<dc:creator>steve</dc:creator>
		<pubDate>Mon, 08 Dec 2008 18:01:30 +0000</pubDate>
		<guid isPermaLink="false">http://blog.3plus4.org/?p=97#comment-1380</guid>
		<description>I&#039;m not clear what makes the class-containment chain any more &quot;lexical&quot; than the superclass-inheritance chain. Wouldn&#039;t re-factoring a method to move it to a superclass cause behavior change with implicit receivers if that method was also defined in a containing class?

Are there circumstances when you would recommend &quot;always do an explicit self-send if ...&quot;?</description>
		<content:encoded><![CDATA[<p>I&#8217;m not clear what makes the class-containment chain any more &#8220;lexical&#8221; than the superclass-inheritance chain. Wouldn&#8217;t re-factoring a method to move it to a superclass cause behavior change with implicit receivers if that method was also defined in a containing class?</p>
<p>Are there circumstances when you would recommend &#8220;always do an explicit self-send if &#8230;&#8221;?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bob</title>
		<link>http://blog.3plus4.org/2008/12/07/a-taste-of-nested-classes-part-2/comment-page-1/#comment-1378</link>
		<dc:creator>bob</dc:creator>
		<pubDate>Mon, 08 Dec 2008 17:48:32 +0000</pubDate>
		<guid isPermaLink="false">http://blog.3plus4.org/?p=97#comment-1378</guid>
		<description>Ah, on a second read, it looks like: the look-up will (dynamically) chase the (static, lexically known) class chain of container classes, invoking the found method on the corresponding (dynamically found) container instance; otherwise does a self-send (really could be &quot;super replace: self with: ...&quot;, since the immediate class was already checked).

Hence migrating to a different container instance should not be allowed (unless with some type / class guarantees, which seems unlikely).

Some kind of message-sequence diagram leading all the way to DNU would make this quite clear.

Thanks</description>
		<content:encoded><![CDATA[<p>Ah, on a second read, it looks like: the look-up will (dynamically) chase the (static, lexically known) class chain of container classes, invoking the found method on the corresponding (dynamically found) container instance; otherwise does a self-send (really could be &#8220;super replace: self with: &#8230;&#8221;, since the immediate class was already checked).</p>
<p>Hence migrating to a different container instance should not be allowed (unless with some type / class guarantees, which seems unlikely).</p>
<p>Some kind of message-sequence diagram leading all the way to DNU would make this quite clear.</p>
<p>Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bob</title>
		<link>http://blog.3plus4.org/2008/12/07/a-taste-of-nested-classes-part-2/comment-page-1/#comment-1377</link>
		<dc:creator>bob</dc:creator>
		<pubDate>Mon, 08 Dec 2008 17:20:50 +0000</pubDate>
		<guid isPermaLink="false">http://blog.3plus4.org/?p=97#comment-1377</guid>
		<description>Thanks Gilad!

Does that mean (a) you look-up container instances dynamically to find lexically visible methods, or (b) compiling a container class method somehow update contained class methods, or (c) something else? Can a contained instance migrate to another container instance?</description>
		<content:encoded><![CDATA[<p>Thanks Gilad!</p>
<p>Does that mean (a) you look-up container instances dynamically to find lexically visible methods, or (b) compiling a container class method somehow update contained class methods, or (c) something else? Can a contained instance migrate to another container instance?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Danil</title>
		<link>http://blog.3plus4.org/2008/12/07/a-taste-of-nested-classes-part-2/comment-page-1/#comment-1376</link>
		<dc:creator>Danil</dc:creator>
		<pubDate>Mon, 08 Dec 2008 16:02:26 +0000</pubDate>
		<guid isPermaLink="false">http://blog.3plus4.org/?p=97#comment-1376</guid>
		<description>Vassily, thank you for the article.

Is it possible to apply class nesting for implementing of recursive (i.e. tree-like) structures of arbitrary depth?</description>
		<content:encoded><![CDATA[<p>Vassily, thank you for the article.</p>
<p>Is it possible to apply class nesting for implementing of recursive (i.e. tree-like) structures of arbitrary depth?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gilad</title>
		<link>http://blog.3plus4.org/2008/12/07/a-taste-of-nested-classes-part-2/comment-page-1/#comment-1375</link>
		<dc:creator>Gilad</dc:creator>
		<pubDate>Mon, 08 Dec 2008 15:28:30 +0000</pubDate>
		<guid isPermaLink="false">http://blog.3plus4.org/?p=97#comment-1375</guid>
		<description>Bob,

I&#039;ll take the liberty of replying.
(a) No. 
(b) If you make implicit receiver calls, yes. As the post explains - you don&#039;t have to. 

As for fragility - (b) can cause fragility, but we trade off one kind of fragility for another. The comb rule (a la NewtonScript) means that adding methods to superclasses can silently  &quot;capture&quot; lexically apparent names. In contrats, the Newspeak rules mean that only local changes (e.g., removing a lexically surrounding method) can have such effects. These are much easier to see and track.</description>
		<content:encoded><![CDATA[<p>Bob,</p>
<p>I&#8217;ll take the liberty of replying.<br />
(a) No.<br />
(b) If you make implicit receiver calls, yes. As the post explains &#8211; you don&#8217;t have to. </p>
<p>As for fragility &#8211; (b) can cause fragility, but we trade off one kind of fragility for another. The comb rule (a la NewtonScript) means that adding methods to superclasses can silently  &#8220;capture&#8221; lexically apparent names. In contrats, the Newspeak rules mean that only local changes (e.g., removing a lexically surrounding method) can have such effects. These are much easier to see and track.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bob</title>
		<link>http://blog.3plus4.org/2008/12/07/a-taste-of-nested-classes-part-2/comment-page-1/#comment-1374</link>
		<dc:creator>bob</dc:creator>
		<pubDate>Mon, 08 Dec 2008 15:12:08 +0000</pubDate>
		<guid isPermaLink="false">http://blog.3plus4.org/?p=97#comment-1374</guid>
		<description>Thanks for the explanation, and, more importantly, discussing intended usage (and easy mis-use :-). It helps a lot.

Would one rule be: if you want the contained instance to migrate to another container instance, don&#039;t nest classes.

I am somewhat concerned about one thing: it seems lexical visibility requires (a) container methods defined before contained methods, and (b) container methods to not be inherited from container super-classes. Are both of these true, and, if so, do they make some things more fragile?</description>
		<content:encoded><![CDATA[<p>Thanks for the explanation, and, more importantly, discussing intended usage (and easy mis-use :-). It helps a lot.</p>
<p>Would one rule be: if you want the contained instance to migrate to another container instance, don&#8217;t nest classes.</p>
<p>I am somewhat concerned about one thing: it seems lexical visibility requires (a) container methods defined before contained methods, and (b) container methods to not be inherited from container super-classes. Are both of these true, and, if so, do they make some things more fragile?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
