<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>xacc.ide</title>
	<atom:link href="http://xacc.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://xacc.wordpress.com</link>
	<description>A small, super fast, opensource and 100% C# IDE targetting .NET-based languages</description>
	<lastBuildDate>Tue, 24 Jan 2012 16:35:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='xacc.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://0.gravatar.com/blavatar/03c351062ae008cc5cfafe97d2141e31?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>xacc.ide</title>
		<link>http://xacc.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://xacc.wordpress.com/osd.xml" title="xacc.ide" />
	<atom:link rel='hub' href='http://xacc.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Decompiler FUUU!!!</title>
		<link>http://xacc.wordpress.com/2011/07/20/decompiler-fuuu/</link>
		<comments>http://xacc.wordpress.com/2011/07/20/decompiler-fuuu/#comments</comments>
		<pubDate>Wed, 20 Jul 2011 09:25:15 +0000</pubDate>
		<dc:creator>leppie</dc:creator>
				<category><![CDATA[Default]]></category>
		<category><![CDATA[IronScheme]]></category>

		<guid isPermaLink="false">http://xacc.wordpress.com/?p=393</guid>
		<description><![CDATA[ILSpy: Debug.ProcedureEnter(ldtoken($1())); // WTF? Reflector: Crashes blatantly! Unhandled &#8216;ldtoken&#8217; at offset 0000. dotPeek: Well well, at least it got this right! Not sure why it is an issue though&#8230; // ISSUE: method reference Debug.ProcedureEnter(__methodref (eval\u002Dcore\u0028003\u0029.\u00241));<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=xacc.wordpress.com&amp;blog=1242361&amp;post=393&amp;subd=xacc&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>ILSpy:</strong></p>
<pre>
Debug.ProcedureEnter(ldtoken($1()));   // WTF?
</pre>
<p><strong>Reflector:</strong></p>
<p>Crashes blatantly! Unhandled &#8216;ldtoken&#8217; at offset 0000.</p>
<p><strong>dotPeek:</strong></p>
<p>Well well, at least it got this right! Not sure why it is an issue though&#8230;</p>
<pre>
// ISSUE: method reference
Debug.ProcedureEnter(__methodref (eval\u002Dcore\u0028003\u0029.\u00241));
</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/xacc.wordpress.com/393/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/xacc.wordpress.com/393/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/xacc.wordpress.com/393/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/xacc.wordpress.com/393/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/xacc.wordpress.com/393/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/xacc.wordpress.com/393/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/xacc.wordpress.com/393/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/xacc.wordpress.com/393/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/xacc.wordpress.com/393/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/xacc.wordpress.com/393/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/xacc.wordpress.com/393/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/xacc.wordpress.com/393/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/xacc.wordpress.com/393/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/xacc.wordpress.com/393/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=xacc.wordpress.com&amp;blog=1242361&amp;post=393&amp;subd=xacc&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://xacc.wordpress.com/2011/07/20/decompiler-fuuu/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/515ca9736a9a8ce65e58af764ccddf46?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">leppie</media:title>
		</media:content>
	</item>
		<item>
		<title>Another Reflector FUUUU</title>
		<link>http://xacc.wordpress.com/2011/07/20/another-reflector-fuuuu/</link>
		<comments>http://xacc.wordpress.com/2011/07/20/another-reflector-fuuuu/#comments</comments>
		<pubDate>Wed, 20 Jul 2011 07:10:52 +0000</pubDate>
		<dc:creator>leppie</dc:creator>
				<category><![CDATA[Default]]></category>
		<category><![CDATA[IronScheme]]></category>

		<guid isPermaLink="false">http://xacc.wordpress.com/?p=387</guid>
		<description><![CDATA[Output from Reflector: public static object $1() { Debug.ProcedureEnter(); Debug.ExpressionIn(); Debug.ExpressionOut(); Closure.Create(new CallTarget1(eval-core(003).::foo), 1); Debug.ExpressionIn(); Debug.ExpressionOut(); Closure.Create(new CallTarget2(eval-core(003).::bar), 2); Debug.ExpressionIn(); Debug.ExpressionOut(); Debug.ExpressionIn(); Debug.ExpressionOut(); ::dummy$2(::foo(RuntimeHelpers.Int32ToObject(20))); return Builtins.Unspecified; Debug.ProcedureExit(); } Output from ILSpy (almost correct): public static object $1() { Debug.ProcedureEnter(); Delegate arg_17_0 = new CallTarget1(eval-core(003).::foo); int arg_17_1 = 1; Debug.ExpressionIn(); Closure.Create(arg_17_0, arg_17_1); Debug.ExpressionOut(); Delegate arg_34_0 = [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=xacc.wordpress.com&amp;blog=1242361&amp;post=387&amp;subd=xacc&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Output from Reflector:</p>
<pre>
public static object $1()
{
  Debug.ProcedureEnter();
  Debug.ExpressionIn();
  Debug.ExpressionOut();
  Closure.Create(new CallTarget1(eval-core(003).::foo), 1);
  Debug.ExpressionIn();
  Debug.ExpressionOut();
  Closure.Create(new CallTarget2(eval-core(003).::bar), 2);
  Debug.ExpressionIn();
  Debug.ExpressionOut();
  Debug.ExpressionIn();
  Debug.ExpressionOut();
  ::dummy$2(::foo(RuntimeHelpers.Int32ToObject(20)));
  return Builtins.Unspecified;
  Debug.ProcedureExit();
}
</pre>
<p>Output from ILSpy (almost correct):</p>
<pre>
public static object $1()
{
	Debug.ProcedureEnter();
	Delegate arg_17_0 = new CallTarget1(eval-core(003).::foo);
	int arg_17_1 = 1;
	Debug.ExpressionIn();
	Closure.Create(arg_17_0, arg_17_1);
	Debug.ExpressionOut();
	Delegate arg_34_0 = new CallTarget2(eval-core(003).::bar);
	int arg_34_1 = 2;
	Debug.ExpressionIn();
	Closure.Create(arg_34_0, arg_34_1);
	Debug.ExpressionOut();
	object arg_4B_0 = RuntimeHelpers.Int32ToObject(20);
	Debug.ExpressionIn();
	object arg_5A_0 = eval-core(003).::foo(arg_4B_0);
	Debug.ExpressionOut();
	Debug.ExpressionIn();
	eval-core(003).::dummy$2(arg_5A_0);
	Debug.ExpressionOut();
	return Builtins.Unspecified;
}
</pre>
<p>Just silly <img src='http://s0.wp.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<p>ILSpy does seem to hide the call to Debug.ProcedureExit(). But that is my bad ;P</p>
<p>Here is the IL:</p>
<pre>
.method public static
	object $1 () cil managed
{
	// Method begins at RVA 0x20dc
	// Code size 112 (0x70)
	.maxstack 3

	IL_0000: call void [Microsoft.Scripting]Microsoft.Scripting.Debugging.Debug::ProcedureEnter()
	IL_0005: ldnull
	IL_0006: ldftn object 'eval-core(003)'::'::foo'(object)
	IL_000c: newobj instance void [Microsoft.Scripting]Microsoft.Scripting.CallTarget1::.ctor(object, native int)
	IL_0011: ldc.i4.1
	IL_0012: call void [Microsoft.Scripting]Microsoft.Scripting.Debugging.Debug::ExpressionIn()
	IL_0017: call class [IronScheme.Closures]IronScheme.Runtime.Callable [IronScheme.Closures]IronScheme.Runtime.Closure::Create(class [mscorlib]System.Delegate, int32)
	IL_001c: call void [Microsoft.Scripting]Microsoft.Scripting.Debugging.Debug::ExpressionOut()
	IL_0021: pop
	IL_0022: ldnull
	IL_0023: ldftn object 'eval-core(003)'::'::bar'(object, object)
	IL_0029: newobj instance void [Microsoft.Scripting]Microsoft.Scripting.CallTarget2::.ctor(object, native int)
	IL_002e: ldc.i4.2
	IL_002f: call void [Microsoft.Scripting]Microsoft.Scripting.Debugging.Debug::ExpressionIn()
	IL_0034: call class [IronScheme.Closures]IronScheme.Runtime.Callable [IronScheme.Closures]IronScheme.Runtime.Closure::Create(class [mscorlib]System.Delegate, int32)
	IL_0039: call void [Microsoft.Scripting]Microsoft.Scripting.Debugging.Debug::ExpressionOut()
	IL_003e: pop
	IL_003f: ldc.i4.s 20
	IL_0041: call object [Microsoft.Scripting]Microsoft.Scripting.RuntimeHelpers::Int32ToObject(int32)
	IL_0046: call void [Microsoft.Scripting]Microsoft.Scripting.Debugging.Debug::ExpressionIn()
	IL_004b: call object 'eval-core(003)'::'::foo'(object)
	IL_0050: call void [Microsoft.Scripting]Microsoft.Scripting.Debugging.Debug::ExpressionOut()
	IL_0055: call void [Microsoft.Scripting]Microsoft.Scripting.Debugging.Debug::ExpressionIn()
	IL_005a: call object 'eval-core(003)'::'::dummy$2'(object)
	IL_005f: call void [Microsoft.Scripting]Microsoft.Scripting.Debugging.Debug::ExpressionOut()
	IL_0064: pop
	IL_0065: ldsfld object [IronScheme]IronScheme.Runtime.Builtins::Unspecified
	IL_006a: ret

	IL_006b: call void [Microsoft.Scripting]Microsoft.Scripting.Debugging.Debug::ProcedureExit()
} // end of method 'eval-core(003)'::$1
</pre>
<p>Output from latest dotPeek:</p>
<pre>
  public static object \u00241()
  {
    Debug.ProcedureEnter();
    CallTarget1 callTarget1 = new CallTarget1(eval\u002Dcore\u0028003\u0029.\u003A\u003Afoo);
    int paramcount1 = 1;
    Debug.ExpressionIn();
    Closure.Create((Delegate) callTarget1, paramcount1);
    Debug.ExpressionOut();
    CallTarget2 callTarget2 = new CallTarget2(eval\u002Dcore\u0028003\u0029.\u003A\u003Abar);
    int paramcount2 = 2;
    Debug.ExpressionIn();
    Closure.Create((Delegate) callTarget2, paramcount2);
    Debug.ExpressionOut();
    object x = RuntimeHelpers.Int32ToObject(20);
    Debug.ExpressionIn();
    object a = eval\u002Dcore\u0028003\u0029.\u003A\u003Afoo(x);
    Debug.ExpressionOut();
    Debug.ExpressionIn();
    eval\u002Dcore\u0028003\u0029.\u003A\u003Adummy\u00242(a);
    Debug.ExpressionOut();
    object obj = Builtins.Unspecified;
    Debug.ProcedureExit();
    return obj;
  }
</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/xacc.wordpress.com/387/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/xacc.wordpress.com/387/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/xacc.wordpress.com/387/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/xacc.wordpress.com/387/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/xacc.wordpress.com/387/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/xacc.wordpress.com/387/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/xacc.wordpress.com/387/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/xacc.wordpress.com/387/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/xacc.wordpress.com/387/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/xacc.wordpress.com/387/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/xacc.wordpress.com/387/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/xacc.wordpress.com/387/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/xacc.wordpress.com/387/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/xacc.wordpress.com/387/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=xacc.wordpress.com&amp;blog=1242361&amp;post=387&amp;subd=xacc&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://xacc.wordpress.com/2011/07/20/another-reflector-fuuuu/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/515ca9736a9a8ce65e58af764ccddf46?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">leppie</media:title>
		</media:content>
	</item>
		<item>
		<title>Reflector FUUUUUUUU!!!</title>
		<link>http://xacc.wordpress.com/2011/05/12/reflector-fuuuuuuuu/</link>
		<comments>http://xacc.wordpress.com/2011/05/12/reflector-fuuuuuuuu/#comments</comments>
		<pubDate>Thu, 12 May 2011 16:53:36 +0000</pubDate>
		<dc:creator>leppie</dc:creator>
				<category><![CDATA[Default]]></category>
		<category><![CDATA[IronScheme]]></category>

		<guid isPermaLink="false">http://xacc.wordpress.com/?p=384</guid>
		<description><![CDATA[What Reflector makes out the C# to be: object[] a = new object[2]; a[0] = symbol_free-id; s11n:8 = objArray[8]; a[1] = s11n:8; $c$00BA = Builtins.List(symbol__, symbol_any, Builtins.ListStar(a, symbol_each-any)); What the actual IL is: L_045e: ldc.i4.2 L_045f: newarr object L_0464: dup L_0465: ldc.i4.0 L_0466: ldsfld object contracts::symbol_free-id L_046b: stelem.ref L_046c: dup L_046d: ldc.i4.1 L_046e: ldsfld object [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=xacc.wordpress.com&amp;blog=1242361&amp;post=384&amp;subd=xacc&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>What Reflector makes out the C# to be:</p>
<pre>
  object[] a = new object[2];
  a[0] = symbol_free-id;
  s11n:8 = objArray[8];
  a[1] = s11n:8;
  $c$00BA = Builtins.List(symbol__, symbol_any, Builtins.ListStar(a, symbol_each-any));
</pre>
<p>What the actual IL is:</p>
<pre>
  L_045e: ldc.i4.2
  L_045f: newarr object
  L_0464: dup
  L_0465: ldc.i4.0
  L_0466: ldsfld object contracts::symbol_free-id
  L_046b: stelem.ref
  L_046c: dup
  L_046d: ldc.i4.1
  L_046e: ldsfld object contracts::s11n:8
  L_0473: ldloc.0
  L_0474: ldc.i4.8
  L_0475: ldelem.ref
  L_0476: stsfld object contracts::s11n:8
  L_047b: stelem.ref
  L_047c: ldsfld object contracts::symbol_each-any
  L_0481: call object [IronScheme]IronScheme.Runtime.Builtins::ListStar(object, object)
  L_0486: call object [IronScheme]IronScheme.Runtime.Builtins::List(object, object, object)
  L_048b: stsfld object contracts::$c$00BA
</pre>
<p>Note, L_046e and L_0476, completely wrong order in the C# <img src='http://s0.wp.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/xacc.wordpress.com/384/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/xacc.wordpress.com/384/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/xacc.wordpress.com/384/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/xacc.wordpress.com/384/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/xacc.wordpress.com/384/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/xacc.wordpress.com/384/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/xacc.wordpress.com/384/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/xacc.wordpress.com/384/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/xacc.wordpress.com/384/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/xacc.wordpress.com/384/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/xacc.wordpress.com/384/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/xacc.wordpress.com/384/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/xacc.wordpress.com/384/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/xacc.wordpress.com/384/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=xacc.wordpress.com&amp;blog=1242361&amp;post=384&amp;subd=xacc&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://xacc.wordpress.com/2011/05/12/reflector-fuuuuuuuu/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/515ca9736a9a8ce65e58af764ccddf46?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">leppie</media:title>
		</media:content>
	</item>
		<item>
		<title>GC.SuppressFinalize and .NET Object Finalizers (or Why printing from the finalizer is not a good idea)</title>
		<link>http://xacc.wordpress.com/2011/02/22/gc-suppressfinalize/</link>
		<comments>http://xacc.wordpress.com/2011/02/22/gc-suppressfinalize/#comments</comments>
		<pubDate>Tue, 22 Feb 2011 12:16:43 +0000</pubDate>
		<dc:creator>leppie</dc:creator>
				<category><![CDATA[Default]]></category>

		<guid isPermaLink="false">http://xacc.wordpress.com/?p=379</guid>
		<description><![CDATA[So there has long been a heavy discussion about calling Dispose on IDisposable objects. This also requires that Dispose be implemented correctly, iow calling GC.SuppressFinalize(this). After my umpteenth time saying it should NOT be needed to call Dispose, I got a response from a well-respected StackOverflow user that made me think about it more. Although [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=xacc.wordpress.com&amp;blog=1242361&amp;post=379&amp;subd=xacc&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>So there has long been a heavy discussion about calling Dispose on IDisposable objects. This also requires that Dispose be implemented correctly, iow calling GC.SuppressFinalize(this). </p>
<p>After my umpteenth time saying it should NOT be needed to call Dispose, I got a response from a well-respected StackOverflow user that made me think about it more. Although he did not mention why I was wrong, I could just had to figure this one out.</p>
<p>As we know, IDisposable is recommended primarily to release unmanaged resources in a deterministic way for managed types. If implemented correctly, you need to call GC.SuppressFinalize in your Dispose method. GC.SuppressFinalize prevents the object&#8217;s finalizer to be called.</p>
<p>All good up to here? </p>
<p>So lets run a little test:</p>
<pre>class Foo
{
  byte[] buffer = new byte[50 * 1024];

  ~Foo()
  {
    Console.WriteLine("Finalized");
  }

  public void Moo()
  {
    Console.WriteLine("Moosposed");
    GC.SuppressFinalize(this);
  }
}

class Program
{
  static void Main(string[] args)
  {
    while (true)
    {
      new Foo();
    }
  }
}
</pre>
<p>Run the above, and within seconds you should get an OutOfMemoryException. Funny, seems the GC is not doing it&#8217;s job, or the printing in the finalizer is causing it not to be collected? This can be &#8216;confirmed&#8217; by removing that printing statement. Strange indeed why something that has no reference to the object can prevent it being finalized. </p>
<p>Now change the code to:</p>
<pre>class Program
{
  static void Main(string[] args)
  {
    while (true)
    {
      new Foo().Moo();
    }
  }
}
</pre>
<p>Now the program runs happily till the cows come home, with barely any memory usage (under 18MB on my PC). So what is happening? Is GC.SuppressFinalize actually freeing the objects memory deterministically when called? It would appear so, but nowhere in any documentation is this extremely important fact noted. It also does not appear so, as adding GC.SuppressFinalize(this) to the finalizer after the printing statement also causes an OutOfMemoryException. Also, why is MS recommending calling GC.SuppressFinalize from the finalizer? This does not make sense. Can it be GC&#8217;d twice?</p>
<p>So all in all, one should never call Console.WriteLine() from within the finalizer else it will prevent the object from being considered for immediate garbage collection. What else can you not call from the finalizer? Clearly, when dealing with unmanaged resources, you will have to at least free them in your Dispose method, but if this is called from the finalizer, it seems you are in the same boat. What happens if your unmanaged component logs stuff to the console when you &#8216;close it&#8217;s handle&#8217; ? Are you doomed?</p>
<p>I think the moral of the story is that one should at all costs prevent calling any unknown code (and Console methods) from the finalizer. This might be the reason why Dispose is pushed so heavily by MS. </p>
<p>On a side note, given we have &#8216;clean&#8217; finalizers, it does not really matter if you call Dispose or not on an IDisposable object. The GC will take care of it, unless something happens like above. </p>
<p>I still stick to my point I made several months back. You <strong>should</strong> call Dispose, however it is not a <strong>must</strong>. It is only a must if it prints something or something that prevents the immediate GC of the object.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/xacc.wordpress.com/379/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/xacc.wordpress.com/379/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/xacc.wordpress.com/379/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/xacc.wordpress.com/379/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/xacc.wordpress.com/379/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/xacc.wordpress.com/379/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/xacc.wordpress.com/379/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/xacc.wordpress.com/379/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/xacc.wordpress.com/379/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/xacc.wordpress.com/379/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/xacc.wordpress.com/379/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/xacc.wordpress.com/379/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/xacc.wordpress.com/379/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/xacc.wordpress.com/379/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=xacc.wordpress.com&amp;blog=1242361&amp;post=379&amp;subd=xacc&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://xacc.wordpress.com/2011/02/22/gc-suppressfinalize/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/515ca9736a9a8ce65e58af764ccddf46?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">leppie</media:title>
		</media:content>
	</item>
		<item>
		<title>Dynamic binding in C#</title>
		<link>http://xacc.wordpress.com/2011/02/02/dynamic-binding-in-c/</link>
		<comments>http://xacc.wordpress.com/2011/02/02/dynamic-binding-in-c/#comments</comments>
		<pubDate>Wed, 02 Feb 2011 14:30:56 +0000</pubDate>
		<dc:creator>leppie</dc:creator>
				<category><![CDATA[Default]]></category>
		<category><![CDATA[IronScheme]]></category>

		<guid isPermaLink="false">http://xacc.wordpress.com/?p=370</guid>
		<description><![CDATA[So someone asked a question on StackOverflow today, and I gathered the best solution was to use dynamic binding. Here follows a simple example on how to achieve it: class DynamicConsole : TextWriter { readonly TextWriter orig; readonly TextWriter output; public DynamicConsole(string filename) { orig = Console.Out; output = File.AppendText(filename); Console.SetOut(output); } public override System.Text.Encoding [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=xacc.wordpress.com&amp;blog=1242361&amp;post=370&amp;subd=xacc&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>So someone asked a <a href="http://stackoverflow.com/questions/4873372/writing-console-out-to-different-output-files/4873649#4873649">question on StackOverflow</a> today, and I gathered the best solution was to use dynamic binding.</p>
<p>Here follows a simple example on how to achieve it:</p>
<pre style='color:black;background-color:white;font-family:Consolas,Bitstream Vera Sans Mono,Lucida Console,Courier New;'><FONT color="Blue">class</FONT> <FONT color="Teal">DynamicConsole</FONT> <FONT color="DarkBlue">:</FONT> <FONT color="Teal">TextWriter</FONT>
<FONT color="DarkBlue">{</FONT>
  <FONT color="Blue">readonly</FONT> <FONT color="Teal">TextWriter</FONT> orig<FONT color="DarkBlue">;</FONT>
  <FONT color="Blue">readonly</FONT> <FONT color="Teal">TextWriter</FONT> output<FONT color="DarkBlue">;</FONT>

  <FONT color="Blue">public</FONT> <FONT color="Teal">DynamicConsole</FONT><FONT color="DarkBlue">(</FONT><FONT color="Blue">string</FONT> filename<FONT color="DarkBlue">)</FONT>
  <FONT color="DarkBlue">{</FONT>
     orig <FONT color="DarkBlue">=</FONT> Console<FONT color="DarkBlue">.</FONT>Out<FONT color="DarkBlue">;</FONT>
    output <FONT color="DarkBlue">=</FONT> File<FONT color="DarkBlue">.</FONT>AppendText<FONT color="DarkBlue">(</FONT>filename<FONT color="DarkBlue">)</FONT><FONT color="DarkBlue">;</FONT>
    Console<FONT color="DarkBlue">.</FONT>SetOut<FONT color="DarkBlue">(</FONT>output<FONT color="DarkBlue">)</FONT><FONT color="DarkBlue">;</FONT>
  <FONT color="DarkBlue">}</FONT>

  <FONT color="Blue">public</FONT> <FONT color="Blue">override</FONT> System<FONT color="DarkBlue">.</FONT>Text<FONT color="DarkBlue">.</FONT><FONT color="Teal">Encoding</FONT> Encoding
  <FONT color="DarkBlue">{</FONT>
    <FONT color="Blue">get</FONT> <FONT color="DarkBlue">{</FONT> <FONT color="Blue">return</FONT> output<FONT color="DarkBlue">.</FONT>Encoding<FONT color="DarkBlue">;</FONT> <FONT color="DarkBlue">}</FONT>
  <FONT color="DarkBlue">}</FONT>

  <FONT color="Blue">public</FONT> <FONT color="Blue">override</FONT> <FONT color="Blue">void</FONT> Write<FONT color="DarkBlue">(</FONT><FONT color="Blue">char</FONT> value<FONT color="DarkBlue">)</FONT>
  <FONT color="DarkBlue">{</FONT>
    output<FONT color="DarkBlue">.</FONT>Write<FONT color="DarkBlue">(</FONT>value<FONT color="DarkBlue">)</FONT><FONT color="DarkBlue">;</FONT>
  <FONT color="DarkBlue">}</FONT>

  <FONT color="Blue">protected</FONT> <FONT color="Blue">override</FONT> <FONT color="Blue">void</FONT> Dispose<FONT color="DarkBlue">(</FONT><FONT color="Blue">bool</FONT> disposing<FONT color="DarkBlue">)</FONT>
  <FONT color="DarkBlue">{</FONT>
    Console<FONT color="DarkBlue">.</FONT>SetOut<FONT color="DarkBlue">(</FONT>orig<FONT color="DarkBlue">)</FONT><FONT color="DarkBlue">;</FONT>
    output<FONT color="DarkBlue">.</FONT>Dispose<FONT color="DarkBlue">(</FONT><FONT color="DarkBlue">)</FONT><FONT color="DarkBlue">;</FONT>
  <FONT color="DarkBlue">}</FONT>
<FONT color="DarkBlue">}</FONT></pre>
<p>Usage:</p>
<pre style='color:black;background-color:white;font-family:Consolas,Bitstream Vera Sans Mono,Lucida Console,Courier New;'>Console<FONT color="DarkBlue">.</FONT>WriteLine<FONT color="DarkBlue">(</FONT><FONT color="Maroon">"Real 1"</FONT><FONT color="DarkBlue">)</FONT><FONT color="DarkBlue">;</FONT>

<FONT color="Blue">using</FONT> <FONT color="DarkBlue">(</FONT><FONT color="Blue">new</FONT> DynamicConsole<FONT color="DarkBlue">(</FONT><FONT color="Maroon">"Foo.txt"</FONT><FONT color="DarkBlue">)</FONT><FONT color="DarkBlue">)</FONT>
<FONT color="DarkBlue">{</FONT>
  Console<FONT color="DarkBlue">.</FONT>WriteLine<FONT color="DarkBlue">(</FONT><FONT color="Maroon">"Moo"</FONT><FONT color="DarkBlue">)</FONT><FONT color="DarkBlue">;</FONT>

  <FONT color="Blue">using</FONT> <FONT color="DarkBlue">(</FONT><FONT color="Blue">new</FONT> DynamicConsole<FONT color="DarkBlue">(</FONT><FONT color="Maroon">"Bar.txt"</FONT><FONT color="DarkBlue">)</FONT><FONT color="DarkBlue">)</FONT>
  <FONT color="DarkBlue">{</FONT>
    Console<FONT color="DarkBlue">.</FONT>WriteLine<FONT color="DarkBlue">(</FONT><FONT color="Maroon">"Ork"</FONT><FONT color="DarkBlue">)</FONT><FONT color="DarkBlue">;</FONT>
  <FONT color="DarkBlue">}</FONT>

  Console<FONT color="DarkBlue">.</FONT>WriteLine<FONT color="DarkBlue">(</FONT><FONT color="Maroon">"Bar"</FONT><FONT color="DarkBlue">)</FONT><FONT color="DarkBlue">;</FONT>
<FONT color="DarkBlue">}</FONT>

Console<FONT color="DarkBlue">.</FONT>WriteLine<FONT color="DarkBlue">(</FONT><FONT color="Maroon">"Real 2"</FONT><FONT color="DarkBlue">)</FONT><FONT color="DarkBlue">;</FONT></pre>
<p>When running you get the following:</p>
<p>This will print to the Console:</p>
<p><code>Real 1<br />
Real 2</code></p>
<p>It will append to Foo.txt:</p>
<p><code>Moo<br />
Bar</code></p>
<p>It will append to Bar.txt:</p>
<p><code>Ork</code></p>
<p>I will update the code later to make it generic, so any property, method or field can be used for the dynamic binding. Stay tuned!</p>
<p><strong>Update:</strong></p>
<p>Posted an article on CodeProject last Friday. This is a generic implementation: <a href="http://www.codeproject.com/KB/cs/dynamicbindingincsharp.aspx">Dynamic binding in C#</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/xacc.wordpress.com/370/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/xacc.wordpress.com/370/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/xacc.wordpress.com/370/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/xacc.wordpress.com/370/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/xacc.wordpress.com/370/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/xacc.wordpress.com/370/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/xacc.wordpress.com/370/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/xacc.wordpress.com/370/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/xacc.wordpress.com/370/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/xacc.wordpress.com/370/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/xacc.wordpress.com/370/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/xacc.wordpress.com/370/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/xacc.wordpress.com/370/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/xacc.wordpress.com/370/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=xacc.wordpress.com&amp;blog=1242361&amp;post=370&amp;subd=xacc&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://xacc.wordpress.com/2011/02/02/dynamic-binding-in-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/515ca9736a9a8ce65e58af764ccddf46?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">leppie</media:title>
		</media:content>
	</item>
		<item>
		<title>Using IronScheme in Unity3D</title>
		<link>http://xacc.wordpress.com/2011/02/01/using-ironscheme-in-unity3d/</link>
		<comments>http://xacc.wordpress.com/2011/02/01/using-ironscheme-in-unity3d/#comments</comments>
		<pubDate>Tue, 01 Feb 2011 18:26:10 +0000</pubDate>
		<dc:creator>leppie</dc:creator>
				<category><![CDATA[Default]]></category>
		<category><![CDATA[IronScheme]]></category>

		<guid isPermaLink="false">http://xacc.wordpress.com/?p=367</guid>
		<description><![CDATA[valerydc has successfully managed to embed and use IronScheme in Unity3D See http://forum.unity3d.com/threads/76266-Facilities-for-script-languages-Scheme-in-particular for details. You can also view the initial discussion @ http://ironscheme.codeplex.com/Thread/View.aspx?ThreadId=243958. Thanks a lot!<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=xacc.wordpress.com&amp;blog=1242361&amp;post=367&amp;subd=xacc&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>valerydc has successfully managed to embed and use IronScheme in Unity3D  <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>See <a href="http://forum.unity3d.com/threads/76266-Facilities-for-script-languages-Scheme-in-particular">http://forum.unity3d.com/threads/76266-Facilities-for-script-languages-Scheme-in-particular</a> for details. You can also view the initial discussion @ <a href="http://ironscheme.codeplex.com/Thread/View.aspx?ThreadId=243958">http://ironscheme.codeplex.com/Thread/View.aspx?ThreadId=243958</a>.</p>
<p>Thanks a lot!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/xacc.wordpress.com/367/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/xacc.wordpress.com/367/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/xacc.wordpress.com/367/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/xacc.wordpress.com/367/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/xacc.wordpress.com/367/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/xacc.wordpress.com/367/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/xacc.wordpress.com/367/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/xacc.wordpress.com/367/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/xacc.wordpress.com/367/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/xacc.wordpress.com/367/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/xacc.wordpress.com/367/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/xacc.wordpress.com/367/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/xacc.wordpress.com/367/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/xacc.wordpress.com/367/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=xacc.wordpress.com&amp;blog=1242361&amp;post=367&amp;subd=xacc&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://xacc.wordpress.com/2011/02/01/using-ironscheme-in-unity3d/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/515ca9736a9a8ce65e58af764ccddf46?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">leppie</media:title>
		</media:content>
	</item>
		<item>
		<title>MTN/HTC service nightmare (updated 10 feb)</title>
		<link>http://xacc.wordpress.com/2011/01/03/mtn-service-nightmare/</link>
		<comments>http://xacc.wordpress.com/2011/01/03/mtn-service-nightmare/#comments</comments>
		<pubDate>Mon, 03 Jan 2011 08:55:31 +0000</pubDate>
		<dc:creator>leppie</dc:creator>
				<category><![CDATA[Default]]></category>
		<category><![CDATA[mtn]]></category>
		<category><![CDATA[service]]></category>

		<guid isPermaLink="false">http://xacc.wordpress.com/?p=339</guid>
		<description><![CDATA[Sadly I had to escalate my service issues to hellopeter.com. Unfortunately, they only have place for 1200 characters. Here is the entire service experience: beginning nov: call MTN regarding the availability of advertised phone (HTC Desire HD), no stock 22 nov: eligible for upgrade, MTN says still no stock 30 nov: get call from MTN [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=xacc.wordpress.com&amp;blog=1242361&amp;post=339&amp;subd=xacc&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Sadly I had to escalate my service issues to <a href="http://www.hellopeter.com/mtn-complaint-[505188]">hellopeter.com</a>. Unfortunately, they only have place for 1200 characters. Here is the entire service experience:</p>
<p>beginning nov: call MTN regarding the availability of advertised phone (HTC Desire HD), no stock<br />
22 nov: eligible for upgrade, MTN says still no stock<br />
30 nov: get call from MTN to say phone is now in stock, proceed upgrade process<br />
2 dec: receive phone (very fast courier service)<br />
2-5 dec: phone has a random reboot problem<br />
6-10 dec: reboot problem stops<br />
11-13 dec: reboot problem comes back<br />
13 dec: report fault with MTNSP and Leaf/HTC (HTC confirms it is a known problem affecting a few phones)<br />
13 dec: phone service get suspended due to account going over R1000, yet the account was only R635, had to increase limit to get activated again<br />
15 dec: took phone into shop (Capegate A, James), said I needed the papers to make repair process go faster<br />
15 dec: went home to fetch papers, tried to book in phone (Capegate A), at last minute MTN system goes offline<br />
15 dec: go to the other shop (Capegate B, Dominique) to do a manual check in for repairs, assistant says she will tell her manager to prioritize it<br />
23 dec: call MTN high volume repair centre for update on repairs, they say they have not received it<br />
23 dec: go back to MTN shop (Capegate B), phone still in the shop, take phone back with me due to lack of service<br />
29 dec: call MTN to discuss service issues, advised to go to MTN service centre in Century City<br />
29 dec: book in phone at MTN service centre (Century City, Sakeena/Francisco), system offline again (MTN TFR# 020149)<br />
31 dec: I changed my bank details when doing the upgrade, yet the money was taken from previous account details<br />
3 jan: called MTN to change banking details, they confirm the change<br />
3 jan: call MTN high volume repair centre for update on repairs, phone has not been booked in yet<br />
3 jan: call MTN service centre (Century City) to find out what is happening, number forwards to 808, no info available<br />
3 jan: called same number again (Century City), got through to someone (Cheryl, the switchboard operator) that says I cannot contact Century City directly, they have open an enquiry for the location of my phone<br />
3 jan: reported to hellopeter out of desperation http://www.hellopeter.com/mtn-complaint-[505188]<br />
3 jan: MTN responded on hellopeter.com with a generic remark which is hardly relevant<br />
3 jan: Cannot contact MTN service centre (Century City), due to broken number (17:15, 17:30, 17:45)<br />
3 jan: Sent this shittogram to the only 2 email addresses advertised for MTN<br />
4 jan: Try call MTN service centre (Century City) again, again Cheryl answers and let me know she will try get someone to contact me<br />
4 jan: Cheryl calls me back to let me know she has reached Sakeena at the service centre and will be in contact with me<br />
4 jan: Sakeena calls me back, and informs me Francisco has taken over the issue, but he is not at work today, but she will ask him to contact me the following day<br />
4 jan: Received feedback on email to confirm my banking details are in order, and my issue has been forwarded to the complaints department<br />
6 jan: Gave feedback on hellopeter<br />
6 jan: Contacted MTN HV repair centre, they confirm the phone has been sent to HTC, and should be back on Monday or Tuesday<br />
10 jan: Called MTN HV repair centre, no further feedback available<br />
10 jan: Called HTC, they can&#8217;t confirm receipt of phone, escalating issue, promised to call me back<br />
11 jan: Called MTN HV repair centre (Thepo), apparently phone has been returned to cape town, but no repair actions were logged, waiting for feedback<br />
11 jan: Thepo called, confirmed phone is at HTC, will be ready before end of the week<br />
11 jan: Called HTC (Chris), informed them I wanted to make sure they find the fault, and not just reload the software. Chris informed me the issue will be escalated to his supervisor, and that they will be in contact with me<br />
13 jan: Called MTN HV repair centre (Nolene), phone still at HTC, no further feedback<br />
17 jan: Called MTN HV repair centre (Thepo), phone still at HTC, &#8216;should&#8217; be back to MTN today<br />
18 jan: Called MTN HV repair centre (Mpho), phone still at HTC, awaiting couriers to MTN<br />
18 jan: Called HTC support (James) to try get a repair report, was told I will get it when collecting the phone<br />
19 jan: Called MTN HV repair centre (Helen), phone was collected from HTC by RTT (assume this is the couriers), not at MTN HVRC yet<br />
20 jan: Phoned everyone from MTN HVRC in JHB and CPT, called LEAF and RTT. The phone is being sent overnite to the CPT HVRC (confirmed by RTT) and that will take several working days before being sent to MTN Century City&#8230; Estimate around 25 jan.<br />
25 jan: Expecting to get phone back today<br />
25 jan: Been in contact with MTN HVRC Cape Town manager (Kevin) who confirmed the phone will be at MTN Century City after 1pm. Informed me that Leaf/HTC did not include a job card with the phone.<br />
25 jan: Contacted HTC support (Chris), have no information about phone repairs<br />
25 jan: Contacted Leaf Repairs, they tell me the software was updated and no other repairs was done&#8230; Spoke to Amit to explain the situation, demanding a replacement phone before the end of the week. He cannot make that decision and told me that the manager (Zach) will contact me tomorrow.<br />
25 jan: Collected the phone at MTN Century City, spoke with Kevin and Noleen about my problems. While there, the phone rebooted 3 times, witnessed by Kevin. There was a repair report from LEAF stating only software was reloaded. Seems no other work was done.<br />
25 jan: Tested a spare backup battery to eliminate the possibility of a faulty battery, but had a reboot within 2 hours after a full charge</p>
<p>25 jan: Still waiting for my phone call from Francisco/feedback regarding complaint from MTN, <del datetime="2011-01-20T10:49:06+00:00">waiting on feedback from HTC</del> (HTC said a repair report will be attached to the phone, never did get back to me&#8230;) and waiting for HTC to contact me on or before Friday.</p>
<p>27 jan: Contacted LEAF&#8217;s technical manager to discuss problems. They arranged for &#8216;express&#8217; repair service. Told them they had to replace the mainboard (as was done with others in my situation).<br />
28 jan: Courier collected phone.<br />
1 feb: LEAF contacts me to inform overnight courier. Phone &#8216;will&#8217; be back tomorrow.<br />
2 feb: Courier delivered the phone this morning with a new mainboard. Will be testing today. Finally after 42 days, I hope I can lay this fiasco to rest.</p>
<p>10 feb: All going well still. No hardware problems.</p>
<p>On 2 Feb, total time phone been @ MTN/HTC = 42 days, @ me = 20 days since receiving the phone. That sucks&#8230;  <img src='http://s0.wp.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<p><del datetime="2011-01-07T05:42:17+00:00">Finally, I have an idea where me phone is, not too happy still, but less stressed. Tomorrow I will see if the phone has actually reached the HV repair centre.</del></p>
<p>I must say Cheryl, the switchboard operator for MTN (Century City) has been by far the kindest and most helpful person in this whole fiasco. Someone make her a manager or give her a raise/bonus, she deserves it. Sakeena has also tried to help. The MTN HVRC (Cape Town) manager, Kevin has been extremely helpful too in tracking down my phone.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/xacc.wordpress.com/339/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/xacc.wordpress.com/339/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/xacc.wordpress.com/339/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/xacc.wordpress.com/339/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/xacc.wordpress.com/339/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/xacc.wordpress.com/339/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/xacc.wordpress.com/339/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/xacc.wordpress.com/339/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/xacc.wordpress.com/339/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/xacc.wordpress.com/339/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/xacc.wordpress.com/339/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/xacc.wordpress.com/339/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/xacc.wordpress.com/339/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/xacc.wordpress.com/339/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=xacc.wordpress.com&amp;blog=1242361&amp;post=339&amp;subd=xacc&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://xacc.wordpress.com/2011/01/03/mtn-service-nightmare/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/515ca9736a9a8ce65e58af764ccddf46?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">leppie</media:title>
		</media:content>
	</item>
		<item>
		<title>Writing fast arithmetic code on IronScheme</title>
		<link>http://xacc.wordpress.com/2010/12/02/writing-fast-arithmetic-code-on-ironscheme/</link>
		<comments>http://xacc.wordpress.com/2010/12/02/writing-fast-arithmetic-code-on-ironscheme/#comments</comments>
		<pubDate>Thu, 02 Dec 2010 05:50:19 +0000</pubDate>
		<dc:creator>leppie</dc:creator>
				<category><![CDATA[Default]]></category>
		<category><![CDATA[IronScheme]]></category>

		<guid isPermaLink="false">http://xacc.wordpress.com/?p=334</guid>
		<description><![CDATA[As some may have noticed, I have started actively working on IronScheme again. After a year of fiddling with other shit like microcontrollers and other hardware-related program, the itch for &#8216;bare-metal&#8217; knowledge has finally subsided enough to let IronScheme take preference. Also, the IronScheme source code is now under a BSD license. The DLR goodies [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=xacc.wordpress.com&amp;blog=1242361&amp;post=334&amp;subd=xacc&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>As some may have noticed, I have started actively working on IronScheme again. After a year of fiddling with other shit like microcontrollers and other hardware-related program, the itch for &#8216;bare-metal&#8217; knowledge has finally subsided enough to let IronScheme take preference.</p>
<p>Also, the IronScheme source code is now under a BSD license. The DLR goodies stays on MSPL however, as moving it to the new Apache license DLR would be too much effort. Now for the rest of the post.</p>
<p>So the general feeling is that most &#8216;dynamic&#8217; languages are pretty poor with number crunching. This is true, as code is mostly generic and have no static typing. The same goes for IronScheme, but you can make code (read hotspots) behave much better with only a little extra effort.</p>
<p>Let&#8217;s take the naive Fibonacci algorithm to use for this example.</p>
<pre style='color:black;background-color:white;font-family:Consolas,Bitstream Vera Sans Mono,Lucida Console,Courier New;'><FONT color="DarkBlue">(</FONT><FONT color="Blue">define</FONT> <FONT color="DarkBlue">(</FONT>fib n<FONT color="DarkBlue">)</FONT>
  <FONT color="DarkBlue">(</FONT><FONT color="Blue">if</FONT> <FONT color="DarkBlue">(</FONT><FONT color="Teal">&lt;</FONT> n <FONT color="Red">2</FONT><FONT color="DarkBlue">)</FONT>
      n
      <FONT color="DarkBlue">(</FONT><FONT color="Teal">+</FONT> <FONT color="DarkBlue">(</FONT>fib <FONT color="DarkBlue">(</FONT><FONT color="Teal">-</FONT> n <FONT color="Red">2</FONT><FONT color="DarkBlue">)</FONT><FONT color="DarkBlue">)</FONT> <FONT color="DarkBlue">(</FONT>fib <FONT color="DarkBlue">(</FONT><FONT color="Teal">-</FONT> n <FONT color="Red">1</FONT><FONT color="DarkBlue">)</FONT><FONT color="DarkBlue">)</FONT><FONT color="DarkBlue">)</FONT><FONT color="DarkBlue">)</FONT><FONT color="DarkBlue">)</FONT></pre>
<p>The main problem here is the usage of generic math operators. They are generally slow, as they cover the entire number hierarchy of Scheme. This can be improved by using the fixnum specific procedures.</p>
<pre style='color:black;background-color:white;font-family:Consolas,Bitstream Vera Sans Mono,Lucida Console,Courier New;'><FONT color="DarkBlue">(</FONT><FONT color="Blue">define</FONT> fibf <FONT color="DarkBlue">(</FONT><FONT color="Blue">lambda</FONT> <FONT color="DarkBlue">(</FONT>n<FONT color="DarkBlue">)</FONT>
  <FONT color="DarkBlue">(</FONT><FONT color="Blue">if</FONT> <FONT color="DarkBlue">(</FONT><FONT color="Teal">fx&lt;?</FONT> n <FONT color="Red">2</FONT><FONT color="DarkBlue">)</FONT>
      n
      <FONT color="DarkBlue">(</FONT><FONT color="Teal">fx+</FONT> <FONT color="DarkBlue">(</FONT>fibf <FONT color="DarkBlue">(</FONT><FONT color="Teal">fx-</FONT> n <FONT color="Red">1</FONT><FONT color="DarkBlue">)</FONT><FONT color="DarkBlue">)</FONT> <FONT color="DarkBlue">(</FONT>fibf <FONT color="DarkBlue">(</FONT><FONT color="Teal">fx-</FONT> n <FONT color="Red">2</FONT><FONT color="DarkBlue">)</FONT><FONT color="DarkBlue">)</FONT><FONT color="DarkBlue">)</FONT><FONT color="DarkBlue">)</FONT><FONT color="DarkBlue">)</FONT><FONT color="DarkBlue">)</FONT></pre>
<p>While the above run significantly faster (about 5 times faster), there is still quite a bit of overhead due to boxing of value types, and overflow checks. This can now be improved by using a statically typed variant of lambda called typed-lambda, and by using some &#8216;unsafe&#8217; operators provided by IronScheme.</p>
<pre style='color:black;background-color:white;font-family:Consolas,Bitstream Vera Sans Mono,Lucida Console,Courier New;'><FONT color="DarkBlue">(</FONT><FONT color="Blue">define</FONT> fibt <FONT color="DarkBlue">(</FONT>typed-lambda <FONT color="DarkBlue">(</FONT>n<FONT color="DarkBlue">)</FONT> <FONT color="DarkBlue">(</FONT><FONT color="DarkBlue">(</FONT>Int32<FONT color="DarkBlue">)</FONT> Int32<FONT color="DarkBlue">)</FONT>
  <FONT color="DarkBlue">(</FONT><FONT color="Blue">if</FONT> <FONT color="DarkBlue">(</FONT>$fx&lt;? n <FONT color="Red">2</FONT><FONT color="DarkBlue">)</FONT>
      n
      <FONT color="DarkBlue">(</FONT>$fx+ <FONT color="DarkBlue">(</FONT>fibt <FONT color="DarkBlue">(</FONT>$fx- n <FONT color="Red">1</FONT><FONT color="DarkBlue">)</FONT><FONT color="DarkBlue">)</FONT> <FONT color="DarkBlue">(</FONT>fibt <FONT color="DarkBlue">(</FONT>$fx- n <FONT color="Red">2</FONT><FONT color="DarkBlue">)</FONT><FONT color="DarkBlue">)</FONT><FONT color="DarkBlue">)</FONT><FONT color="DarkBlue">)</FONT><FONT color="DarkBlue">)</FONT><FONT color="DarkBlue">)</FONT></pre>
<p>The above only requires minor changes again, that could be easily made transparent with a macro or 2. The result is a very fast procedure that runs optimally on .NET (when compared to the same code generated by the C# compiler). My tests show it running almost 13 times faster than the fixnum version and subsequently around 60 times faster than the original generic approach.</p>
<p>Here are timings for all of the above:</p>
<pre>isc fibs.sps
Statistics for '(fib 35)':
  Real Time:  8357ms
  CPU Time:   8344ms
  User Time:  8344ms
  GC's:       0
Statistics for '(fibf 35)':
  Real Time:  1826ms
  CPU Time:   1828ms
  User Time:  1828ms
  GC's:       0
Statistics for '(fibt 35)':
  Real Time:  147ms
  CPU Time:   141ms
  User Time:  141ms
  GC's:       0 </pre>
<p><strong>Update:</strong></p>
<p>On the same PC, IronPython 2.6 takes 3150ms for a <a href="http://en.literateprograms.org/Fibonacci_numbers_%28Python%29">naive fib</a>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/xacc.wordpress.com/334/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/xacc.wordpress.com/334/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/xacc.wordpress.com/334/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/xacc.wordpress.com/334/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/xacc.wordpress.com/334/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/xacc.wordpress.com/334/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/xacc.wordpress.com/334/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/xacc.wordpress.com/334/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/xacc.wordpress.com/334/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/xacc.wordpress.com/334/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/xacc.wordpress.com/334/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/xacc.wordpress.com/334/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/xacc.wordpress.com/334/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/xacc.wordpress.com/334/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=xacc.wordpress.com&amp;blog=1242361&amp;post=334&amp;subd=xacc&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://xacc.wordpress.com/2010/12/02/writing-fast-arithmetic-code-on-ironscheme/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/515ca9736a9a8ce65e58af764ccddf46?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">leppie</media:title>
		</media:content>
	</item>
		<item>
		<title>My tags on StackOverflow</title>
		<link>http://xacc.wordpress.com/2010/10/15/my-tags-on-stackoverflow/</link>
		<comments>http://xacc.wordpress.com/2010/10/15/my-tags-on-stackoverflow/#comments</comments>
		<pubDate>Fri, 15 Oct 2010 14:41:18 +0000</pubDate>
		<dc:creator>leppie</dc:creator>
				<category><![CDATA[Default]]></category>

		<guid isPermaLink="false">http://xacc.wordpress.com/?p=329</guid>
		<description><![CDATA[Interesting Tags scheme lisp code-golf language-agnostic ironscheme c#* .net* Ignored Tags vb6 vba vb homework grails coldfusion flash iphone air sifr ms-access db2 vbscript perl sap jpa gql java-ee magento ipad qt weblogic blackberry gwt pentaho wordpress mac corba intellij-idea lucene safari seo redis itouch ant antlr ada gtk doctrine lotus tomcat jcl mongodb netlogo [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=xacc.wordpress.com&amp;blog=1242361&amp;post=329&amp;subd=xacc&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>Interesting Tags</strong><br />
scheme lisp code-golf language-agnostic ironscheme c#* .net*</p>
<p><strong>Ignored Tags</strong><br />
vb6 vba vb homework grails coldfusion flash iphone air sifr ms-access db2 vbscript perl sap jpa gql java-ee magento ipad qt weblogic blackberry gwt pentaho wordpress mac corba intellij-idea lucene safari seo redis itouch ant antlr ada gtk doctrine lotus tomcat jcl mongodb netlogo nosql smalltalk beamer scala spring symbian netbeans agile firebird samba jasper-reports sybase fortran qtp itunes sqlite soapui acrobat actionscript* flex* cocoa* struts* ruby* zend* *php* java-* joomla* maven* *hibernate* ipod* xcode* jboss* dotnetnuke* *facebook* java groovy* *jaxb* kanban iphone* telerik osx python* jsf* jquery* r latex oracle* android* devexpress umbraco* mathematica awk sed *dreamweaver* symfony* crystal-reports* alfresco *postgres* dojo* codeigniter* xbap oscommerce cucumber mod-rewrite mysql* jpa* extjs semantic-web kohana* django* sqlalchemy cufon birt .htaccess inno-setup jira drupal* postscript swf* automapper ssas jms asterisk amazon-ecs ios* delphi* labview jvm* *payment* *dynamics* yahoo-pipes websphere* siebel plsql* couchdb* plone elmah vb.net applescript seam opencv *swing* emf erlang* pygtk mercurial twitter-api wxwidgets boost* boxee core-data ssis numpy xtrareport sitecore* yui* fxcop festival eiffel spring* raphael* liferay oauth elearning xulrunner lotusscript outlook* jar memcached heroku spam sonar tcl adobe tapestry cmake thunderbird jqtouch tomcat* ravendb jena *ejb* eclipse-pde installshield amazon-ec2 cognos* bada node.js accurev swi-prolog seam2 junit4 excel-vba 3270 firewatir jface informix bing* h2 mybatis clojure* *qt4* eclipse-rcp quickfix komodo* mootools* uiwebview episerver doctrine* awt* wix kannel lwuit jscrollpane jmeter mfc solid openfire openid yslow rational-rose jdbc stripes dokuwiki foxpro clearcase saas richfaces filemaker jcr midp* weblogic* wxpython guava interface-builder macports smartgwt jre cassandra qt-creator rabbitmq asp-classic jetpack xmlbeans m2eclipse itextsharp authlogic blackberry* hudson j2se dbunit firebird2.1 jdo javamail wordpress* documentum sass sphinx* openlayers webkit *solr* gradle paypal* jqgrid* jni lucene.net perltk n2 axis2 gae-datastore lua npapi photoshop nusoap *curl* maple autocad vim appstore* lotus-notes subsonic* cocos2d* ssrs-2008 collatz windows-live-messenger testcocoon monotouch xul scala-2* pdftk velocity terrier dicom visualforce exchange-server nvelocity prolog cobol azure log4j selenium* *fcgid asp autofac xmpp beanstalk meebo vtk findbugs exist twitter* openoffice* redmine finch comet go uml-modeling analysis-services bioinformatics openflashchart2 uml cloud jtable mondrian bugzilla *gtk* ecos adobe-reader sugarcrm swt jersey ffmpeg tibco-ems citrix rspec jsoup core-audio mumps aptana* jruby aspose playframework hadoop propel osx-snow-leopard icefaces tibco beautifulsoup solaris pascal bb-messenger sybase* javadoc abap powerbuilder* hbase buildforge e4x poppler coremidi j prism salesforce eclipse-plugin roblox pyqt* iolanguage kynetx bdd logrotate voicexml lamp informatica thrift vxworks flot mod-perl modelica wamp amazon-web-services fusioncharts prestashop izpack mustache javacard flv flash* perl6 parrot ofbiz dkim jetty rake cappuccino yql nsstring typo3 gecko java-me boinc sesame paramiko gstreamer ivy vb.net-2010 oc4j yii glassfish junit cen-xfs pexpect template-toolkit netbeans-6.9 genshi disqus validationengine textmate tabhost jndi jrockit commission-junction phing jstl perforce monit youtube pylons adsense fish-shell lxml sencha* gps cxf nginx coq arcobjects cherrypy* cqrs qooxdoo rmysql puppet jackson hudson* cleartool s-maxage nicedit octave cruisecontrol erp teamcity* nokia* capistrano mongoid yii* rapidminer plesk buildr ipad* *lucene* javafx rich powerpc krl fancybox protege magento* mkreversegeocoder jsp* fpdf rebol jung graphael drools rpy2 maya fortify* gsoap aspectj avaudioplayer pyramid rhapsody spf fltk xerces* wicket pbs padrino xforms scintilla coldfusion* git windows-mobile* *svn* database-design gcore *svm* sharding 3dsmax d amazon* eclipse* pyaudio primefaces tinymce flickr-api documentum* smarty* activetcl rsync loadrunner titanium caliburn shopify vbulletin macvim imagemagick mailchimp gis odata xna bash bbedit sparc fullcalendar coffeescript jgroups rhodes wampserver powerpoint* ibm-midrange dashcode dnn* jython msword jxl sas *bpm* batch orkut inotify batch-file cron chmod business-intelligence pymssql maximo aspell *yaml* fbjs putty postfix grep excel modx jnlp freemarker hamachi red5 openx slickgrid jmx sinatra gerrit processing.js *glassfish* ext-gwt lynx vfp axis2c vce palm* scons sproutcore orchard winnovative openerp jfreechart way-off-topic *dbcp orchardcms skype *mongo* pear plupload zeromq vaadin hl7 blogger gnome jupload mindstorms foursquare fireworks hypervisor soa gmock series-40 jdk* testng restructuredtext matplotlib pagerank haml bouncycastle cython axis watin jmock itunes* meld multitenancy shell igoogle guice mint autohotkey esb valgrind installshield* iwork sim ubuntu* narwhal contribute github telerik* jgit gate unix antlr* jekyll peoplesoft phonegap greasemonkey lotus* vst thinking-sphinx linux sftp liquibase ssh log4net aria kindle tinyxml analytics *gwt* ssrs-tablix jcarousel firefox-addon infragistics xtratreelist *cvs* vlc hql love2d sitefinity staruml watir llblgen* windows-phone* vi graphicsmagick testcomplete e107 jasper* notepad++ msword2003 linkedin postgis advertising mediawiki haxe url-shortener aix wowza psd groupwise rhomobile melt yahoo-boss-api ns2 nagios pebs dismax gnuplot matlab* fedora openstreetmap sparql jrebel debian qt* qml ps3 lyx mpi mifare membase mvcc opencl sage 3ds sfml zos htmltidy adwords clay initio radgrid couchapp xampp lighttpd openmpi activex bazaar collada nutch autotools terracotta zen google* existdb apache* elgg uiview* lint brew ireport ibatis dwr clearcase* tmux sourcegear-vault esent tmx autoit mechanicalturk icu box2d cpanel *fbml uisearchbar* uisplit* rvm n900 adaboost ruby-on-rails-3 yahoo bjam fedex-api uitableview* *pascal* vivo* blazeds teradata safari* cabal* grails* slickedit j2me* kaminari paperclip docbook arkanoid obiee ckeditor uiscrollview* three20 visio lync* zookeeper jwplayer coda* saxon knockoutjs catiledlayer uinavigation* seam3 appfabric uistatus* expressionengine nstextview altova ace revit* webos twiki xpand andengine uilabel pdflatex exchange* zalgo* zk pca xen* velocity* ado innodb simpledb openal xwindow* core-plot netezza gxt posix saml firefox* vrml mule* highcharts* bonjour edi antivirus chromium orbeon simulink jasig epl relaxng quickbasic qbasic rexx pig hsqldb sikuli robohelp graphite nexus* greenplum seaside compass-css jammer vmware infopath* nuget* jaws celery extjs* microsoft-communicator excel* tumblr biztalk* neo4j* haproxy zope* stata nimbus bitbucket* navicat uitab* jenkins chef basic4android gyp corona* emacs* scrapy* indexeddb chipmunk moodle freebase* objective-c* refinerycms reddot install4j phonegap* hdfs ghostscript* openrasta janus liferay* nxc adwhirl componentone monkeyrunner gmail* talend ormlite qemu maxima xalan realbasic *-vba dozer quicksand apple* metatrader* activemq* radius webstorm opensso mapper interbase microsoft-search-server codechef sox jcarousellite silktest sqlite* sccm* *fortran* powerdesigner *netty *jscript* fmdb *jade rpm titanium-mobile spotify playn appmobi scorm* jeditable javafx* acceleo qpid flyway ews flattr sqoop flask* ipython yard osmf fest</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/xacc.wordpress.com/329/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/xacc.wordpress.com/329/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/xacc.wordpress.com/329/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/xacc.wordpress.com/329/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/xacc.wordpress.com/329/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/xacc.wordpress.com/329/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/xacc.wordpress.com/329/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/xacc.wordpress.com/329/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/xacc.wordpress.com/329/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/xacc.wordpress.com/329/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/xacc.wordpress.com/329/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/xacc.wordpress.com/329/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/xacc.wordpress.com/329/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/xacc.wordpress.com/329/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=xacc.wordpress.com&amp;blog=1242361&amp;post=329&amp;subd=xacc&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://xacc.wordpress.com/2010/10/15/my-tags-on-stackoverflow/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/515ca9736a9a8ce65e58af764ccddf46?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">leppie</media:title>
		</media:content>
	</item>
		<item>
		<title>Calling an instance method in the CLR without an instance</title>
		<link>http://xacc.wordpress.com/2009/12/07/calling-an-instance-method-in-the-clr-without-an-instance/</link>
		<comments>http://xacc.wordpress.com/2009/12/07/calling-an-instance-method-in-the-clr-without-an-instance/#comments</comments>
		<pubDate>Mon, 07 Dec 2009 18:43:30 +0000</pubDate>
		<dc:creator>leppie</dc:creator>
				<category><![CDATA[Default]]></category>

		<guid isPermaLink="false">http://xacc.wordpress.com/?p=317</guid>
		<description><![CDATA[A question came up how StackOverflow, blah. I have heard about this behaviour being valid in C++, so I thought I would test it on the CLR. .class Program { .method static void Main(string[] args) { .entrypoint .locals init ([0] class Program p) ldloc.0 // but wait, it's still null! call instance void Program::Awesome() ret [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=xacc.wordpress.com&amp;blog=1242361&amp;post=317&amp;subd=xacc&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><img src="http://xacc.files.wordpress.com/2008/10/time-to-stop.png?w=500" alt="" title="time-to-stop"   class="aligncenter size-full wp-image-132" /></p>
<p>A question came up how <a href="http://stackoverflow.com/questions/1861733/can-a-readonly-field-in-net-become-null">StackOverflow</a>, blah.</p>
<p>I have heard about this behaviour being valid in C++, so I thought I would test it on the CLR.</p>
<pre>
.class Program
{
  .method static void  Main(string[] args)
  {
    .entrypoint
    .locals init ([0] class Program p)
    ldloc.0 // but wait, it's still null!
    call   instance void Program::Awesome()
    ret
  } 

  .method instance void Awesome()
  {
    ldstr      "Awesome!"
    call       void [mscorlib]System.Console::WriteLine(string)
    ret
  } 

  .method public specialname rtspecialname instance void  .ctor()
  {
    ldarg.0
    call       instance void [mscorlib]System.Object::.ctor()
    ret
  }
}
</pre>
<p>As you can see if you compile the program, &#8220;Awesome!&#8221; is printed.</p>
<p>Now run PEVerify. As you can see, perfect valid CLR code.</p>
<p>But how? And why wont in work in C#?</p>
<p>The C# compiler will in all cases (even weirdly, but probably for good reason) emit a callvirt instead of the call I used. This causes the runtime to perform a null check.</p>
<p>Secondly, the is no instance member access, so no references to &#8216;this&#8217; need to be made.</p>
<p>Why is this like this? Not sure, but if I would guess, they left this specification loose, to allow for more flexibility in other languages.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/xacc.wordpress.com/317/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/xacc.wordpress.com/317/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/xacc.wordpress.com/317/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/xacc.wordpress.com/317/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/xacc.wordpress.com/317/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/xacc.wordpress.com/317/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/xacc.wordpress.com/317/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/xacc.wordpress.com/317/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/xacc.wordpress.com/317/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/xacc.wordpress.com/317/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/xacc.wordpress.com/317/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/xacc.wordpress.com/317/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/xacc.wordpress.com/317/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/xacc.wordpress.com/317/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=xacc.wordpress.com&amp;blog=1242361&amp;post=317&amp;subd=xacc&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://xacc.wordpress.com/2009/12/07/calling-an-instance-method-in-the-clr-without-an-instance/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/515ca9736a9a8ce65e58af764ccddf46?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">leppie</media:title>
		</media:content>

		<media:content url="http://xacc.files.wordpress.com/2008/10/time-to-stop.png" medium="image">
			<media:title type="html">time-to-stop</media:title>
		</media:content>
	</item>
	</channel>
</rss>
