I just recently came across an article entitled Introduction to MSIL. I have only had a chance to read chapter 2, but the series looks like a promising read for anyone wanting a simple introduction to learning IL.
Month: June 2006
Disabling buttons on click in ASP.NET
We have all seen the websites that disable "submit" buttons when you click on them. This is often done to prevent users from clicking the button multiple times.
Normally this is accomplished using an ‘onclick’ JavaScript event to disable the button. In ASP.NET, each server side item already has a onclick event handler which calls the server back for event processing.
To accomplish the same thing in ASP.NET, you could easily do:
Making a Compiler For The CLR
I recently found an article on how to build a compiler for the CLR. This seems to be a real good introduction to using Reflection.Emit as the backbone of the compiler. All the examples are written in VB.NET, but is easy enough to read for even the most die hard C# fans.
Vista… you can tell its Windows
I spent all day yesterday downloading the community beta of Windows Vista, only to get the royal Windows treatment.
After downloading Vista, and burning it to DVD I began installing it. The installation system is great. It is much better than anything Microsoft has done so far.
After having completed the installation, it informed me that it would have to restart my computer to complete. Upon restart it began to start Vista… then blue screened.
I tried every thing I could think of, but it kept crashing shortly after loading crcdisk.sys, and complained about some sort of internal error. I even tried reinstalling it, but that did not produce any different results.
I guess this is Microsoft’s kind way of reminding us all that Vista is still Windows.
Tail Recursion
It appears that the CLR supports proper tail recursion.
Normally when a function is called, a new frame is created on the stack. This can cause problems when too many stack entries are created, resulting in a stack overflow.
Fortunately their is an ingenious solution to this problem, called proper tail recursion. Something is tail recursive if it calls itself as the very last operation before it returns. If not implemented properly, a compiler (or run-time) will still produce stack frames, and could eventually produce an overflow.
Since the recursive call was the last thing the function performed, there is no real reason to return to it. Because of this, there is also no reason to keep the stack frames for such functions. This is exactly what happens in a proper implementation of tail recursion, the current stack frame is overwritten by the next frame. This allows for (if you desired) infinite recursion, or at least deep recursion, without the worry of a stack overflow.