<?xml version='1.0' encoding='UTF-8' ?>
<rss version="2.0" xmlns:admin="http://webns.net/mvcb/" xmlns:blogChannel="http://backend.userland.com/blogChannelModule" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:icbm="http://postneo.com/icbm" xmlns:includedComments="http://www.laudably.com/rss2-comments" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:media="http://search.yahoo.com/mrss/" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/">
	<channel>
		<title>Learning to Talk</title>
		<link>http://www.cincomsmalltalk.com/userblogs/malby/blogView</link>
		<description>Learning to Talk</description>
		<webMaster>sean@arcturus.com.au</webMaster>
		<lastBuildDate>Fri, 21 Sep 2007 13:12:06 EDT</lastBuildDate>
		<image>
			<url>/images/why-small.png</url>
			<title>Learning to Talk</title>
			<link>http://www.cincomsmalltalk.com/blog/blogView</link>
			<height>50</height>
			<width>81</width>
		</image>
		<admin:generatorAgent rdf:resource="/CincomSmalltalkWiki/Silt"></admin:generatorAgent>
		<admin:errorReportsTo rdf:resource="mailto:sean@arcturus.com.au"></admin:errorReportsTo>
		<dc:language>en-us</dc:language>
		<dc:creator>Sean Malloy</dc:creator>
		<dc:rights>Copyright 2005 Sean Malloy</dc:rights>
		<dc:date>2007-09-21T13:12:06-04:00</dc:date>
		<icbm:latitude>-35.283333</icbm:latitude>
		<icbm:longitude>149.133333</icbm:longitude>
		<item>
			<title>Smalltalk vs C# vs C++ - A generic template story</title>
			<link>http://www.cincomsmalltalk.com/userblogs/malby/blogView?showComments=true&amp;printTitle=Smalltalk_vs_C_vs_C++_-_A_generic_template_story&amp;entry=3309487346</link>
			<category>Learning Smalltalk</category>
			<pubDate>Tue, 15 Nov 2005 06:02:26 EST</pubDate>
			<description><![CDATA[<div xmlns="http://www.w3.org/1999/xhtml">
<p>I got thrown in at the deep end at work recently. I was moved to work on a piece of software which was all written in C++. So I've been spending some time on the dark side.</p><p>I'm happy to say that all that power (complexity) has left a bad taste in my mouth. It's made me cling to my Smalltalk even more tightly, however I have to say C++ does have some pretty cool stuff going for it. The "simple" operator overloading (opposed to C#)&nbsp;ans also C++ templates. </p><p>I knew what C# generics were before I knew what C++ templates were. Although I knew that generics were based on templates, I'd never actually done anything in C++, so it was a kind of meaningless comment to me. </p><p>This post came about when I tried to write a simple Smalltalk like Interval class in C# and generics. I succeeded, but it required me to define two a generic Interval&lt;T&gt; class, two interfaces, one for doing the step addition, and one for doing the comparison between the current and end positions, and two implementations of the Additiona/LessThan operator interfaces. It worked, but damn it wasn't straight forward. I've put the code here if you're interested. I did two versions; One using anonymous methods, and one using interfaces. <a href="http://www.arcturus.com.au/code/Interval.cs">Interval.cs</a>. This is not the "One True Way" (I could have used an enumerator and yielded each value, a new feature in C# 2.0.. anyways!) .. as you can see from the code, it's crufty. There is a lot of code to write for what should be something quite simple.</p><p>Next I wrote up a C++ version. <a href="http://www.arcturus.com.au/code/Interval.cpp">Interval.cpp</a>. Guess what, much simpler! </p><p>Finally here is a pseudo-Smalltalk version, because it isn't proper chunk format (I wrote it in notepad) which does the same thing. <a href="http://www.arcturus.com.au/code/Interval.st">Interval.st</a>.</p><p>One comment on this: I think it is the only time you'll see C++ code that is close to Smalltalk, and has the same requirements on the object the Interval steps over: that the object implements the messages #&lt;= and #+. The issue with C# is that C# CAN NOT use operators with generics. I didn't realise why there was an uproar about this when generics for C# was first announced, but now I understand.</p><p>BTW, if you've never actually used Smalltalk before, there is already a very rich and useful Interval class which implements the collection protocol, so you can actually do things like iterate over it using #collect: #select: and so on. Very nice indeed. There is no such equivelent in the static world.</p><p><a href="http://www.cincomsmalltalk.com/blog/blogView">James</a> has made a couple of posts recently on the issues with generics in C# and Java. Every time I start to write any generic code in C#, I wonder why people can make comments about Smalltalk being the train that "rusted at the station", when clearly that's just not possible when the Smalltalk train was made out of nice shiny stainless steel.</p><p>Update: Oops. Fixed the broken links</p>
</div>]]></description>
			<guid isPermaLink="false">3309487346</guid>
			<pingback:server>http://www.cincomsmalltalk.com/userblogs/malby/servlet/CommentAPIPBServlet?guid=3309487346</pingback:server>
			<pingback:target>http://www.cincomsmalltalk.com/userblogs/malby/blogView?guid=3309487346</pingback:target>
			<includedComments:comment-collection>
				<includedComments:comment>
					<includedComments:guid>blogView?showComments=true&amp;printTitle=Smalltalk_vs_C_vs_C++_-_A_generic_template_story&amp;entry=3309487346</includedComments:guid>
					<includedComments:puid>blogView?showComments=true&amp;printTitle=Smalltalk_vs_C_vs_C++_-_A_generic_template_story&amp;entry=3309487346</includedComments:puid>
					<includedComments:author>Isaac Gouy</includedComments:author>
					<includedComments:pubDate>2005-11-15T18:52:51-05:00</includedComments:pubDate>
					<includedComments:content>&lt;div xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;p&gt;&lt;blockquote&gt;"There is no such equivelent in the static world"&lt;/blockquote&gt;&lt;br/&gt;
What, specifically, is there no such equivalent to in the static world?&lt;br/&gt;&lt;br/&gt;
(I'm feeling a little over-awed that someone knows what's going on in every corner of "the static world".) &lt;/p&gt;
&lt;/div&gt;</includedComments:content>
					<includedComments:title>Specifically?</includedComments:title>
				</includedComments:comment>
				<includedComments:comment>
					<includedComments:guid>blogView?showComments=true&amp;printTitle=Smalltalk_vs_C_vs_C++_-_A_generic_template_story&amp;entry=3309487346</includedComments:guid>
					<includedComments:puid>blogView?showComments=true&amp;printTitle=Smalltalk_vs_C_vs_C++_-_A_generic_template_story&amp;entry=3309487346</includedComments:puid>
					<includedComments:author>
James Robertson</includedComments:author>
					<includedComments:pubDate>2005-11-15T19:38:38-05:00</includedComments:pubDate>
					<includedComments:content>&lt;div xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;p&gt;Comment by 
James Robertson&lt;/p&gt;

&lt;p&gt;


&lt;p&gt;I'm feeling a little over-awed at your seeming need to gainsay everything we say about dynamic typing here. It's like an obsession, or something :)&lt;/p&gt;
&lt;/p&gt;
&lt;/div&gt;</includedComments:content>
					<includedComments:title>
Really?</includedComments:title>
				</includedComments:comment>
				<includedComments:comment>
					<includedComments:guid>blogView?showComments=true&amp;printTitle=Smalltalk_vs_C_vs_C++_-_A_generic_template_story&amp;entry=3309487346</includedComments:guid>
					<includedComments:puid>blogView?showComments=true&amp;printTitle=Smalltalk_vs_C_vs_C++_-_A_generic_template_story&amp;entry=3309487346</includedComments:puid>
					<includedComments:author>Sean</includedComments:author>
					<includedComments:pubDate>2005-11-15T22:01:02-05:00</includedComments:pubDate>
					<includedComments:content>&lt;div xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;p&gt;"There is no such equivelent in the static world"


&lt;/p&gt;
&lt;p&gt;I was referring to the Collection protocols. 


&lt;/p&gt;
&lt;p&gt;I happily acknowledge my sweeping generalisation, and it was made with Collection heirarchies available in the other languages 
that &lt;u&gt;I&lt;/u&gt; have had personal experience with in mind. Feel over-awed if you want, or perhaps next time you can 
actually provide real input. Silly me, how could I expect that of you&lt;b&gt;


&lt;/p&gt;
&lt;p&gt;Allow me to tighten my statement: In my own minimal experience I have yet to find anything that matches the Smalltalk collection protocols, whose elegance comes from Smalltalks message based design, &amp;lt;bold&amp;gt;&amp;lt;blink&amp;gt;IMHO&amp;lt;/blink&amp;gt;&amp;lt;/bold&amp;gt;.
&lt;/p&gt;&lt;/b&gt;
&lt;/div&gt;</includedComments:content>
					<includedComments:title>Heh</includedComments:title>
				</includedComments:comment>
				<includedComments:comment>
					<includedComments:guid>blogView?showComments=true&amp;printTitle=Smalltalk_vs_C_vs_C++_-_A_generic_template_story&amp;entry=3309487346</includedComments:guid>
					<includedComments:puid>blogView?showComments=true&amp;printTitle=Smalltalk_vs_C_vs_C++_-_A_generic_template_story&amp;entry=3309487346</includedComments:puid>
					<includedComments:author>Isaac Gouy</includedComments:author>
					<includedComments:pubDate>2005-11-17T03:09:23-05:00</includedComments:pubDate>
					<includedComments:content>&lt;div xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;p&gt;&lt;em&gt;yet to find anything that matches the Smalltalk collection protocols&lt;/em&gt;&lt;br/&gt;
Why do you think that is? Do the other languages you know not provide an equivalent to blocks? Do they not provide a common enumeration protocol for arrays, and lists, and...?&lt;br/&gt;

&lt;pre&gt;void main(String[] args) { 
   for (int i : ( [1, 2, 3, 4, 5].filter( int i =&gt; i &gt; 3 ))) println(i);
   println();
   for (int i : ( new ArrayList([1, 2, 3, 4, 5]).filter( int i =&gt; i &gt; 2 ))) println(i);
}

I:\&gt;java -jar t.jar
4
5

3
4
5
&lt;/pre&gt;    
&lt;/p&gt;&lt;/div&gt;</includedComments:content>
					<includedComments:title>More specifically</includedComments:title>
				</includedComments:comment>
				<includedComments:comment>
					<includedComments:guid>blogView?showComments=true&amp;printTitle=Smalltalk_vs_C_vs_C++_-_A_generic_template_story&amp;entry=3309487346</includedComments:guid>
					<includedComments:puid>blogView?showComments=true&amp;printTitle=Smalltalk_vs_C_vs_C++_-_A_generic_template_story&amp;entry=3309487346</includedComments:puid>
					<includedComments:author>Isaac Gouy</includedComments:author>
					<includedComments:pubDate>2005-11-17T19:13:43-05:00</includedComments:pubDate>
					<includedComments:content>&lt;div xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;p&gt;Do they not provide a common enumeration protocol for reference types and primitive types?

&lt;/p&gt;&lt;pre&gt;
void main(String[] args) { 
   [1, 2, 3, 4, 5]
      .filter( int i =&gt; i &gt; 3 ).foreach( int i =&gt; println(i) );

   println();

   [new Thing(id:1), new Thing(id:2), new Thing(id:3), new Thing(id:4), new Thing(id:5)]
      .filter( Thing t =&gt; t.id &lt; 3 ).foreach( Thing t =&gt; println(t.id) );
}

class Thing { int id; }


I:\&gt;java -jar t.jar
4
5

1
2
&lt;/pre&gt;  
&lt;/div&gt;</includedComments:content>
					<includedComments:title>More specifically</includedComments:title>
				</includedComments:comment>
				<includedComments:comment>
					<includedComments:guid>blogView?showComments=true&amp;printTitle=Smalltalk_vs_C_vs_C++_-_A_generic_template_story&amp;entry=3309487346</includedComments:guid>
					<includedComments:puid>blogView?showComments=true&amp;printTitle=Smalltalk_vs_C_vs_C++_-_A_generic_template_story&amp;entry=3309487346</includedComments:puid>
					<includedComments:author>Sean M</includedComments:author>
					<includedComments:pubDate>2005-11-17T19:53:23-05:00</includedComments:pubDate>
					<includedComments:content>&lt;div xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;p&gt;"Do the other languages you know not provide an equivalent to blocks?"


&lt;/p&gt;
&lt;p&gt;Please do give a Java example of using a block/closure? BTW, what version of Java should I be using to compile that code you provided?&lt;/p&gt;
&lt;/div&gt;</includedComments:content>
					<includedComments:title>Sorry</includedComments:title>
				</includedComments:comment>
				<includedComments:comment>
					<includedComments:guid>blogView?showComments=true&amp;printTitle=Smalltalk_vs_C_vs_C++_-_A_generic_template_story&amp;entry=3309487346</includedComments:guid>
					<includedComments:puid>blogView?showComments=true&amp;printTitle=Smalltalk_vs_C_vs_C++_-_A_generic_template_story&amp;entry=3309487346</includedComments:puid>
					<includedComments:author>Isaac Gouy</includedComments:author>
					<includedComments:pubDate>2005-11-18T13:46:00-05:00</includedComments:pubDate>
					<includedComments:content>&lt;div xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;p&gt;&lt;em&gt;Please do give a Java example of using a block/closure&lt;/em&gt;&lt;br/&gt;
Now I understand! When you wrote "There is no such equivelent in the static world" you actually meant "There is no such equivelent in the Java world".&lt;br/&gt;&lt;br/&gt;

&lt;em&gt;compile that code&lt;/em&gt;&lt;br/&gt;
It isn't Java - it's one of those many other statically type checked languages.  
&lt;/p&gt;&lt;/div&gt;</includedComments:content>
					<includedComments:title>no such equivelent in the Java world</includedComments:title>
				</includedComments:comment>
				<includedComments:comment>
					<includedComments:guid>blogView?showComments=true&amp;printTitle=Smalltalk_vs_C_vs_C++_-_A_generic_template_story&amp;entry=3309487346</includedComments:guid>
					<includedComments:puid>blogView?showComments=true&amp;printTitle=Smalltalk_vs_C_vs_C++_-_A_generic_template_story&amp;entry=3309487346</includedComments:puid>
					<includedComments:author>Sean</includedComments:author>
					<includedComments:pubDate>2005-11-20T23:24:51-05:00</includedComments:pubDate>
					<includedComments:content>&lt;div xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;p&gt;Hence my comment about generalising.


&lt;/p&gt;
&lt;p&gt;So tell me, what &lt;b&gt;is&lt;/b&gt; the language you're posting snippets from?&lt;/p&gt;
&lt;/div&gt;</includedComments:content>
					<includedComments:title>Yeah...</includedComments:title>
				</includedComments:comment>
				<includedComments:comment>
					<includedComments:guid>blogView?showComments=true&amp;printTitle=Smalltalk_vs_C_vs_C++_-_A_generic_template_story&amp;entry=3309487346</includedComments:guid>
					<includedComments:puid>blogView?showComments=true&amp;printTitle=Smalltalk_vs_C_vs_C++_-_A_generic_template_story&amp;entry=3309487346</includedComments:puid>
					<includedComments:author>Isaac Gouy</includedComments:author>
					<includedComments:pubDate>2005-11-21T02:58:58-05:00</includedComments:pubDate>
					<includedComments:content>&lt;div xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;p&gt;That was Nice.&lt;br/&gt;
For someone curious about what is being done with reasonably familiar kinds of programming language more documentation is available for &lt;a href="http://scala.epfl.ch/"&gt;Scala&lt;/a&gt;.


 
&lt;/p&gt;&lt;/div&gt;</includedComments:content>
					<includedComments:title>Nice, Scala, ...</includedComments:title>
				</includedComments:comment>
				<includedComments:comment>
					<includedComments:guid>blogView?showComments=true&amp;printTitle=Smalltalk_vs_C_vs_C++_-_A_generic_template_story&amp;entry=3309487346</includedComments:guid>
					<includedComments:puid>blogView?showComments=true&amp;printTitle=Smalltalk_vs_C_vs_C++_-_A_generic_template_story&amp;entry=3309487346</includedComments:puid>
					<includedComments:author>Sean</includedComments:author>
					<includedComments:pubDate>2005-11-21T06:29:16-05:00</includedComments:pubDate>
					<includedComments:content>&lt;div xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;p&gt;Thanks for the link&lt;b&gt;&lt;/p&gt;&lt;/b&gt;
&lt;/div&gt;</includedComments:content>
					<includedComments:title>Thanks</includedComments:title>
				</includedComments:comment>
				<includedComments:comment>
					<includedComments:guid>blogView?showComments=true&amp;printTitle=Smalltalk_vs_C_vs_C++_-_A_generic_template_story&amp;entry=3309487346</includedComments:guid>
					<includedComments:puid>blogView?showComments=true&amp;printTitle=Smalltalk_vs_C_vs_C++_-_A_generic_template_story&amp;entry=3309487346</includedComments:puid>
					<includedComments:author>David Salamon</includedComments:author>
					<includedComments:pubDate>2006-01-26T06:30:25-05:00</includedComments:pubDate>
					<includedComments:content>&lt;div xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;p&gt;The Boost library for c++ (boost.org) has a lambda library.

some example code:
&lt;pre&gt;
#include&amp;lt;iostream&amp;gt; //std::cout
#include&amp;lt;vector&amp;gt; //std::vector
#include&amp;lt;algorithms&amp;gt; //for_each
#include"boost/lambda.hpp" //_1
int main() {
  std::vector&amp;lt;int&amp;gt; a;
  for_each(0, 100, _1 = i); // add 0..99 to the list
  for_each(a.begin(), a.end(), std::cout &amp;lt;&amp;lt; _1 &amp;lt;&amp;lt; std::endl); // print the list
  return 0;
}
&lt;/pre&gt;

this is all done with templates and no preprocessor.
for_each takes two iterators and a function pointer.. _1 is an object that returns an object implementing operator() which stands in for that function pointer.

Please note that the above is type safe.

hope this helps any smalltalkers that think they need to suffer whenever they use C++ :D       
&lt;/p&gt;&lt;/div&gt;</includedComments:content>
					<includedComments:title>C++ comes very close to blocks</includedComments:title>
				</includedComments:comment>
				<includedComments:comment>
					<includedComments:guid>blogView?showComments=true&amp;printTitle=Smalltalk_vs_C_vs_C++_-_A_generic_template_story&amp;entry=3309487346</includedComments:guid>
					<includedComments:puid>blogView?showComments=true&amp;printTitle=Smalltalk_vs_C_vs_C++_-_A_generic_template_story&amp;entry=3309487346</includedComments:puid>
					<includedComments:author>David Salamon</includedComments:author>
					<includedComments:pubDate>2006-01-26T06:55:11-05:00</includedComments:pubDate>
					<includedComments:content>&lt;div xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;p&gt;I'm feeling guilty because the above code won't compile.&lt;br /&gt;
The problem is that for&lt;u&gt;each will try an dereference the ints.&lt;br /&gt;

use the following for&lt;/u&gt;each instead of the normal &amp;lt;algorithm&amp;gt; one:&lt;br /&gt;
&lt;/p&gt;&lt;pre&gt;
template&amp;lt;typename _InIt, typename _Fn&amp;gt;
_Fn for_each(const _InIt&amp; first, const _InIt&amp; second, _Fn f) {
	for(_InIt i(first); i != second; ++i)
		f(*i);
	return f;
}

template&amp;lt;typename _Fn&amp;gt;
_Fn for_each(const int first, const int second, _Fn f) {
	for(int i(first); i != second; ++i)
		f(i);
	return f;
}
&lt;/pre&gt;
&lt;/div&gt;</includedComments:content>
					<includedComments:title>correction</includedComments:title>
				</includedComments:comment>
			</includedComments:comment-collection>
		</item>
		<item>
			<title>Smalltalk Inlining</title>
			<link>http://www.cincomsmalltalk.com/userblogs/malby/blogView?showComments=true&amp;printTitle=Smalltalk_Inlining&amp;entry=3308420429</link>
			<category>Dolphin</category>
			<pubDate>Wed, 02 Nov 2005 21:40:29 EST</pubDate>
			<description><![CDATA[<div xmlns="http://www.w3.org/1999/xhtml">
<p>Recently at a programmers meeting we were having a discussion about the inline keyword, and when it may or may not actually have the intended effect. It lead me to think about a shortcut construct Dolphin has which is sort of an inline (but nothing like the C++ form).</p>

<p>It actually came about when I was writing some extensions to the built in Dolphin Sockets package. Dolphin exposes enough of the Winsock library to implement completely functional Socket applications, however there are various socket options that you might want to add, which requires adding some loose methods of your own. ANYWAYS, I was asking myself a question: How to store constants?</p>

<ul>

<li>In a Pool Dictionary</li>

<li>In a Class Message</li>

<li>Other</li></ul>

<p>A Pool Dictionary was my newbie immediate choice. It maps straight onto the same "concept" of constants in any C language. It does require you modify the class signature to import the pool though? </p>

<p>Next I thought that the constants might be best implemented using class messages. Instead of having a RAAD_WRITE pool constant with a value of 1, I have a #readWrite class message which simply returns 1.</p>

<p>The only "downside" to this is that it requires a message send, which has more overheard than a pool constant (which is inlined at compile time)</p>

<p>However, Dolphin has special syntax for evaluating code at compile time only, ##(), useful for storing calculations which are more intention revealing as: minutes := ##(60 * 60 * 24) rather than minutes := 86400. You can apply it to message sends though. </p>

<p>So we have three options:</p>

<p>Pool Constant: value := READ_WRITE.</p>

<p>Class Message Send: value := self class readWrite.</p>

<p>Dolphin Syntax: value := ##(MyObject readWrite).</p>

<p>The CompiledMethod for both the Pool COnstant and Special Syntax form are identical. The compiler inlines the value (1) into the bytecode. Howver the message send bytecode contains the additional overhead of sending&nbsp;the #readWrite message to the instance methods class. So my question is, which is the best option?</p>

<p>In VisualWorks, I would assume that the JIT Engine is good enough to work out that the message #readWrite is constant, and should be inlined anyway, so I don't think you would even bother with a pool constant in VisualWorks?&nbsp;Then again, how do you inline a message&nbsp;which may be overridden by a subclass? Not for my feeble mind to understand...&nbsp;</p>

<p>However, in Squeak or Dolphin, which are not JIT capable, you would probably want to use pool constants. I do like the Dolphin compile-time-expression syntax though. </p>
</div>]]></description>
			<guid isPermaLink="false">3308420429</guid>
			<pingback:server>http://www.cincomsmalltalk.com/userblogs/malby/servlet/CommentAPIPBServlet?guid=3308420429</pingback:server>
			<pingback:target>http://www.cincomsmalltalk.com/userblogs/malby/blogView?guid=3308420429</pingback:target>
			<includedComments:comment-collection>
				<includedComments:comment>
					<includedComments:guid>blogView?showComments=true&amp;printTitle=Smalltalk_Inlining&amp;entry=3308420429</includedComments:guid>
					<includedComments:puid>blogView?showComments=true&amp;printTitle=Smalltalk_Inlining&amp;entry=3308420429</includedComments:puid>
					<includedComments:author>
Terry</includedComments:author>
					<includedComments:pubDate>2005-11-03T07:50:33-05:00</includedComments:pubDate>
					<includedComments:content>&lt;div xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;p&gt;Comment by 
Terry&lt;/p&gt;

&lt;p&gt;


&lt;p&gt;If I were not concerned about decompiled code, the approach I would take for VW would be to define a special PoolDictionary, or now it would be a Namespace, such that when the compiler finds a variable in the pool,  instead of putting a binding reference in the compiled method it would put the actual value in the method.&lt;/p&gt;
&lt;p&gt;However, as I mentioned, if you were to decompile the code you would no longer see the symbolic name but the actual value.&lt;/p&gt;&lt;/p&gt;
&lt;/div&gt;</includedComments:content>
					<includedComments:title>
Inlining constants</includedComments:title>
				</includedComments:comment>
			</includedComments:comment-collection>
		</item>
		<item>
			<title>Why dynamic?</title>
			<link>http://www.cincomsmalltalk.com/userblogs/malby/blogView?showComments=true&amp;printTitle=Why_dynamic&amp;entry=3306766823</link>
			<category>Smalltalk</category>
			<pubDate>Fri, 14 Oct 2005 18:20:23 EDT</pubDate>
			<description><![CDATA[<div xmlns="http://www.w3.org/1999/xhtml">
<p>Last weekend I slapped together an SCGI handler for Dolphin. Actually it's pretty generic it could probably run in any dialect. Anyways...</p><p>While I've been testing it, I thought it might be useful to have counter for the number of requests the SCGI Handler has served so far.</p><p>So I added a requests instance variable, added two methods to get the current requests, and another to increment the requests when ever a request is handled, and I was done.</p><p>What does being a dynamic environment have anything to do with it? Well I hadn't actually taken the server down at any time. So while I was adding new functionality to it, it was still running, and still serving requests. Now the instance that is processing SCGI requests from Apache responds to the #requests message, and reports on how many connections it has handled.</p><p>No need to restart the system/server. How cool is that?</p>
</div>]]></description>
			<guid isPermaLink="false">3306766823</guid>
			<pingback:server>http://www.cincomsmalltalk.com/userblogs/malby/servlet/CommentAPIPBServlet?guid=3306766823</pingback:server>
			<pingback:target>http://www.cincomsmalltalk.com/userblogs/malby/blogView?guid=3306766823</pingback:target>
			<includedComments:comment-collection></includedComments:comment-collection>
		</item>
		<item>
			<title>More on Extension Methods</title>
			<link>http://www.cincomsmalltalk.com/userblogs/malby/blogView?showComments=true&amp;printTitle=More_on_Extension_Methods&amp;entry=3304273158</link>
			<category>.NET</category>
			<pubDate>Thu, 15 Sep 2005 21:39:18 EDT</pubDate>
			<description><![CDATA[<div xmlns="http://www.w3.org/1999/xhtml">
<p>I spent some time playing with extension methods last night. They're what I expected. The compiler replaces your psuedo-instance method calls, with your static method definitions. It's a nice feature, and will lead to <strong>certain</strong> pieces of code looking simpler.</p>

<p>I was still hopeful, so I started testing out some very basic double dispatch type code (Think Magnitude classes, think Seaside rendering framework). It ended up a failure. I ended up writing a lot of duplicated methods with overloaded function signatures to get the compiler to do what I wanted.</p>

<p>I even tried using generics to force the compiler into doing what I wanted, and that didn't even work. <a href="http://www.arcturus.com.au/code/ExtensionMethodExample.cs">Here is the example</a>. Please look at the code.</p>

<p>The output I am looking for is:</p>

<p>Integer: 1<br />Default<br />String: Hello<br />DateTime: 16/09/2005</p>

<p>Example one outputs the following:</p>

<p>Default<br />Default<br />Default<br />Default</p>

<p>While this might seem strange to those with a Smalltalk background. It isn't when you realise what the compiler is doing in the background. What the C# compiler does is just replaces calls to printOn with the closest matching printOn method it can find in the LooseMethods class (LooseMethods is just my name, it doesn't actually matter what you call it). In the case of example one, the closest matching method is always PrintOn(this Object obj, TextWriter writer). So I thought, Ok, I'll get a litlle trickier, and use Generics to try and help the compiler. Example two is using Generics. And the output?</p>

<p>Default<br />Default<br />Default<br />Default</p>

<p>Strange? Probably. I think that this version should have had the correct output, but it didn't. However once I got to that point I wasn't actually caring any more, because the first example let me down so much. </p>

<p>The only way to get the code working "correctly", is to provide overloaded methods on the Printer/GenericPrinter for each specific type you intend to handle, it also means if you have abstract types, or cast something to "Object" (Or pull it out of an ArrayList of Objects) you won't get the behaviour you would if you were using Smalltalk.</p>

<p>Having said all that. The extension methods are still a nice way to tack on domain specific methods to existing classes, but definitely not a solution to mix-ins or true generic programming in something like Smalltalk.</p>
</div>]]></description>
			<guid isPermaLink="false">3304273158</guid>
			<pingback:server>http://www.cincomsmalltalk.com/userblogs/malby/servlet/CommentAPIPBServlet?guid=3304273158</pingback:server>
			<pingback:target>http://www.cincomsmalltalk.com/userblogs/malby/blogView?guid=3304273158</pingback:target>
			<includedComments:comment-collection>
				<includedComments:comment>
					<includedComments:guid>blogView?showComments=true&amp;printTitle=More_on_Extension_Methods&amp;entry=3304273158</includedComments:guid>
					<includedComments:puid>blogView?showComments=true&amp;printTitle=More_on_Extension_Methods&amp;entry=3304273158</includedComments:puid>
					<includedComments:author></includedComments:author>
					<includedComments:pubDate>2006-06-14T10:20:40-04:00</includedComments:pubDate>
					<includedComments:content>&lt;div xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;p&gt;
&lt;/p&gt;&lt;/div&gt;</includedComments:content>
					<includedComments:title>Untitled</includedComments:title>
				</includedComments:comment>
			</includedComments:comment-collection>
		</item>
		<item>
			<title>Actually, maybe Extension Methods aren't as fantastic as I initially thought...</title>
			<link>http://www.cincomsmalltalk.com/userblogs/malby/blogView?showComments=true&amp;printTitle=Actually,_maybe_Extension_Methods_arent_as_fantastic_as_I_initially_thought...&amp;entry=3304188302</link>
			<category>general</category>
			<pubDate>Wed, 14 Sep 2005 22:05:02 EDT</pubDate>
			<description><![CDATA[<div xmlns="http://www.w3.org/1999/xhtml">
<p>Reading the spec.. Its not going to be as useful as I initially thought.</p>

<p>Given that you can not declare a static method virtual, you can't add an extension method to Object, and then override that in your own objects, although I guess you could maybe declare a virtual method on your own heirarchy, and then every other (non-heirarchy) object gets the default Extension version, and then hopefully you can just add additional extension methods for any other built in types.</p>

<p>Also it only applies to Methods, but I'm assuming properties will also be covered because they're just syntactic sugar for methods anyway... so you could do something like...</p>

<p><pre>public static class BaseExtensions

{

	public static TimeSpan Days(this Int32 value) {

		return new TimeSpan(value, 0, 0, 0);

	}



	public static DateTime FromNow(this TimeSpan value) {

		return DateTime.Now.Substract(value);

	}

}</pre>

<p></p>

<p>And convert code that looks like this:</p>

<p>DateTime date = DateTime.Now.Subtract(new TimeSpan(7, 0, 0, 0));</p>

<p>Into this:</p>

<p>DateTime date = 7.Days().FromNow(); </p>

<p>I'd argue that the Smalltalk equivilent is more readable (7 days fromNow), but still, there is some interesting things that could be done to enhance the object heirarchy in the .NET Framework, on a project by project basis of course. </p>

<p>I'm so sick of seeing projects with classes like StringUtils or CollectionUtils. </p>

<p>I'm just thankful I can go home at night, boot up the laptop, and use a <a href="http://www.object-arts.com/">real</a> <a href="http://www.squeak.org/">genuinely</a> <a href="http://smalltalk.cincom.com/">modifiable</a> environment.</p>
</div>]]></description>
			<guid isPermaLink="false">3304188302</guid>
			<pingback:server>http://www.cincomsmalltalk.com/userblogs/malby/servlet/CommentAPIPBServlet?guid=3304188302</pingback:server>
			<pingback:target>http://www.cincomsmalltalk.com/userblogs/malby/blogView?guid=3304188302</pingback:target>
			<includedComments:comment-collection>
				<includedComments:comment>
					<includedComments:guid>blogView?showComments=true&amp;printTitle=Actually,_maybe_Extension_Methods_arent_as_fantastic_as_I_initially_thought...&amp;entry=3304188302</includedComments:guid>
					<includedComments:puid>blogView?showComments=true&amp;printTitle=Actually,_maybe_Extension_Methods_arent_as_fantastic_as_I_initially_thought...&amp;entry=3304188302</includedComments:puid>
					<includedComments:author>Sean</includedComments:author>
					<includedComments:pubDate>2005-09-14T22:15:31-04:00</includedComments:pubDate>
					<includedComments:content>&lt;div xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;p&gt;Should be DateTime.Now.Add(value);&lt;/p&gt;
&lt;/div&gt;</includedComments:content>
					<includedComments:title>Oops...</includedComments:title>
				</includedComments:comment>
				<includedComments:comment>
					<includedComments:guid>blogView?showComments=true&amp;printTitle=Actually,_maybe_Extension_Methods_arent_as_fantastic_as_I_initially_thought...&amp;entry=3304188302</includedComments:guid>
					<includedComments:puid>blogView?showComments=true&amp;printTitle=Actually,_maybe_Extension_Methods_arent_as_fantastic_as_I_initially_thought...&amp;entry=3304188302</includedComments:puid>
					<includedComments:author>Mark Derricutt</includedComments:author>
					<includedComments:pubDate>2005-09-18T21:41:44-04:00</includedComments:pubDate>
					<includedComments:content>&lt;div xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;p&gt; Actually, .Subtract() works just fine.  You just need SeansForgottenExtentions.cs in the build somewhere to add that other method...

As much as the ability to extend classes like this (and even moreso in the Smalltalks and LISPs) I wonder how much more confusing it'll make understanding a project.

Unlike a smalltalk browser where these new methods are shown directly next to the existing ones, a user of vi or emacs might look at String.cs and wonder just where the hell seansUberHandyUsedEverywhereMethod() is defined.

I wonder what IDE support VisualStudio is giving to these extended methods...&lt;/p&gt;
&lt;/div&gt;</includedComments:content>
					<includedComments:title>Actually....</includedComments:title>
				</includedComments:comment>
				<includedComments:comment>
					<includedComments:guid>blogView?showComments=true&amp;printTitle=Actually,_maybe_Extension_Methods_arent_as_fantastic_as_I_initially_thought...&amp;entry=3304188302</includedComments:guid>
					<includedComments:puid>blogView?showComments=true&amp;printTitle=Actually,_maybe_Extension_Methods_arent_as_fantastic_as_I_initially_thought...&amp;entry=3304188302</includedComments:puid>
					<includedComments:author>Me</includedComments:author>
					<includedComments:pubDate>2005-09-19T01:35:26-04:00</includedComments:pubDate>
					<includedComments:content>&lt;div xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;p&gt;Apparently the methods will only work when you specifically import them with a using statement... IE, if my methods are in a "UberExtensions" namespace, then you would have to specifically pull in that namespace to use it.. But it still opens up the possibility of unexpected methods being available.


&lt;/p&gt;
&lt;p&gt;As far as how Visual Studio will handle them.. 2005 not very well (There is basically a patch to make VS stop complaining about the invalid code you are producing).. I would expect Orcas/2007 to have full support by then and some easy/nice way to see the extensions.. 


&lt;/p&gt;
&lt;p&gt;But I have no plans to still be using .NET by then. In any way shape or form.
&lt;/p&gt;
&lt;/div&gt;</includedComments:content>
					<includedComments:title>Requires using statements...</includedComments:title>
				</includedComments:comment>
			</includedComments:comment-collection>
		</item>
		<item>
			<title>LINQ and Extension Methods</title>
			<link>http://www.cincomsmalltalk.com/userblogs/malby/blogView?showComments=true&amp;printTitle=LINQ_and_Extension_Methods&amp;entry=3304187097</link>
			<category>.NET</category>
			<pubDate>Wed, 14 Sep 2005 21:44:57 EDT</pubDate>
			<description><![CDATA[<div xmlns="http://www.w3.org/1999/xhtml">
<p>LINQ is the new integrated query engine for the .NET platform. There is a nice write up <a href="http://wesnerm.blogs.com/net_undocumented/2005/09/linq.html">about it here</a>.</p>

<p>However, one critical piece I missed in any of the information available on the internet so far, is a tiny little feature called Extension Methods.</p>

<p>Eric Gunnerson <a href="http://blogs.msdn.com/ericgu/archive/2005/09/14/466510.aspx">gave the details</a>:</p>

<blockquote>

<p>The second addition is something known as an extension method. Say that you're writing a new web-based game, and you need a way to convert from standard English to Leet Speak. You would like to be able to add a method to the string class, but because String is sealed (for some very good reasons), you can't. What you end up doing is writing a static method and calling it, but it's not very seamless.</p>

<p>With extension methods, you can write the following:</p>

<p><pre>public static class StringExtensions

{

    public static string MakeLeet(this string source)

   {

      // return the Leet string here...

   }

}</pre>

<p></p>

<p>You then write:</p>

<p><pre>string s = "I have found the programming features of C# 3.0 to be most envigorating";

string leet = s.MakeLeet();

Console.WriteLine(leet);</pre>

<p></p>

<p>and you get the following as output:</p>

<p>y0 d00d, C# 3.0 rox0rz, w00t!!!!!!!!!!!!</p></blockquote>

<p>While I'm guessing you don't get access to the internals of the objects you tack your new methods on to, this is better than nothing. I'm not a fan of the syntax, but who cares, Wow, You can keep your LINQ. This is the feature I want. I requested this as a feature in C# long long ago (after really getting into Smalltalk), as have many other people, and lo and behold, it will be available in 3.0. This should allow you to do away with most <strong>is/typeof/GetType()</strong> code once and for all. Now if only they could some how work out a way to provide real classes, with real class methods....&nbsp;For further details check the <a href="http://download.microsoft.com/download/9/5/0/9503e33e-fde6-4aed-b5d0-ffe749822f1b/csharp%203.0%20specification.doc">language spec</a>.</p>

<p>"Re-inventing Smalltalk one decade at a time."</p>
</div>]]></description>
			<guid isPermaLink="false">3304187097</guid>
			<pingback:server>http://www.cincomsmalltalk.com/userblogs/malby/servlet/CommentAPIPBServlet?guid=3304187097</pingback:server>
			<pingback:target>http://www.cincomsmalltalk.com/userblogs/malby/blogView?guid=3304187097</pingback:target>
			<includedComments:comment-collection></includedComments:comment-collection>
		</item>
		<item>
			<title>The US is definitely not prepared for a terrorist attack.</title>
			<link>http://www.cincomsmalltalk.com/userblogs/malby/blogView?showComments=true&amp;printTitle=The_US_is_definitely_not_prepared_for_a_terrorist_attack.&amp;entry=3303929131</link>
			<category>general</category>
			<pubDate>Sun, 11 Sep 2005 22:05:31 EDT</pubDate>
			<description><![CDATA[<div xmlns="http://www.w3.org/1999/xhtml">
<p>4 year since the attack in New York. 4 years and two wars later. Those of us who live in the rest of the world were pretty sure that the USA was spending lots of money on systems to make their country safer for citizens. I'm pretty sure now that this has been 4 years of smoke and mirrors.</p>

<p>You would think that given the situation the US finds itself in these days, that at least some amount of money would have been put aside for help/training/aid in a major emergency. ANY emergency. I guess that isn't the case.</p>

<p>Witness Katrina devastating the city of New Orleans. Now swap Hurricane for Nuclear detonation. Instead of putrid city sewage, replace that with radioactive material. Imagine the thousands of people actively <a href="http://www.livejournal.com/users/sfsocialists/3687.html">turned away from help, and forced back into the glowing radioactive city</a>&nbsp;of hell.</p>

<p>I think the worst "political bullet dodge" I have heard a politician vomit (EVER!), was that Katrina and caused more damage and chaos than anyone could have possibly imagined.</p>

<p>Looks to me like National Geographic <a href="http://www3.nationalgeographic.com/ngm/0410/feature5/">should start publishing lotto numbers</a>.</p>
</div>]]></description>
			<guid isPermaLink="false">3303929131</guid>
			<pingback:server>http://www.cincomsmalltalk.com/userblogs/malby/servlet/CommentAPIPBServlet?guid=3303929131</pingback:server>
			<pingback:target>http://www.cincomsmalltalk.com/userblogs/malby/blogView?guid=3303929131</pingback:target>
			<includedComments:comment-collection></includedComments:comment-collection>
		</item>
		<item>
			<title>Nice looking Dolphin site.</title>
			<link>http://www.cincomsmalltalk.com/userblogs/malby/blogView?showComments=true&amp;printTitle=Nice_looking_Dolphin_site.&amp;entry=3302962576</link>
			<category>Dolphin</category>
			<pubDate>Wed, 31 Aug 2005 17:36:16 EDT</pubDate>
			<description><![CDATA[<div xmlns="http://www.w3.org/1999/xhtml">
<p>Only noticed this by referrer links: <a href="http://www.dolphinmap.net/">Dolphin Map</a>. Nice one Udo.
</p></div>]]></description>
			<guid isPermaLink="false">3302962576</guid>
			<pingback:server>http://www.cincomsmalltalk.com/userblogs/malby/servlet/CommentAPIPBServlet?guid=3302962576</pingback:server>
			<pingback:target>http://www.cincomsmalltalk.com/userblogs/malby/blogView?guid=3302962576</pingback:target>
			<includedComments:comment-collection></includedComments:comment-collection>
		</item>
		<item>
			<title>More Dolphin 6 News</title>
			<link>http://www.cincomsmalltalk.com/userblogs/malby/blogView?showComments=true&amp;printTitle=More_Dolphin_6_News&amp;entry=3302925904</link>
			<category>Dolphin</category>
			<pubDate>Wed, 31 Aug 2005 07:25:04 EDT</pubDate>
			<description><![CDATA[<div xmlns="http://www.w3.org/1999/xhtml">
<p>I've been plugging away at a port of Seaside. It's been a work in progress for many months, shelved for a while, and now I'm back on it. Anyways...</p><p>I contacted Andy to see if Object Arts would be offended if I ported the old LPC Socktalk code to Dolphin Value Edition. The reason being Dolphin VE doesn't have a Sockets package, which obviously means no network support. A bit of a problem if say, you wanted to run Seaside/Swazoo.</p><p>Andy said it would be no problem, but suggested that I would be wasting my time, given that the Dolphin 6 Community Edition <strong>will</strong> include the Sockets package! Good news all round.</p><p>A month or so ago I begged for Dolphin 6 Community Edition to include sockets support. Looks like the begging was successful.</p>
</div>]]></description>
			<guid isPermaLink="false">3302925904</guid>
			<pingback:server>http://www.cincomsmalltalk.com/userblogs/malby/servlet/CommentAPIPBServlet?guid=3302925904</pingback:server>
			<pingback:target>http://www.cincomsmalltalk.com/userblogs/malby/blogView?guid=3302925904</pingback:target>
			<includedComments:comment-collection></includedComments:comment-collection>
		</item>
	</channel>
</rss>
