Follow up

by Miguel de Icaza

Mark Pilgrim has a great follow up to his freedom-0 article.

Nemerle, C# and Anonymous Methods.

Spent some time this afternoon playing with Nemerle and their latest release.

Specially nice since now MonoDevelop supports Nemerle in the built-in editor.

My main problem is that I find it hard to think in any other way which is not the standard programming that I have grown up to do, maybe I need a hobby programming task to do. It will have to wait until we release Mono 1.0, right now things are busy.

My personal wish: I would like a C#-like scripting language myself. Sprinkle a few perlisms, rubyisms and pythonisms in there. Drop the class carcass.

A small patch I have been playing with in my copious spare time is one to turn all unresolved method calls in C# to a dynamic code translation. So basically:


  object a = new XmlDocument ();
  a.Load ("/tmp/a.xml");

ie, notice that the type of the variable is `o'. The downside: the runtime has to transform the incoming parameters to something that matches the call, you loose the compiler safety net, and its slower. But at least you can prototype quickly ;-)

I do not like the current implementation of anonymous methods, it really does not work in the presence of nested anonymous methods, so I have gone back to the drawing board and have now a new design for this internal chunk of the compiler that am a lot happier with. As soon as the beast compiles, I will upload a new patch.

The C# compiler also gained recently a new flag: -pkg:NAME which integrates pkg-config directly into the compiler. We are making the world a better place, one command line option a day.

Managed code is fast

Andreas, Ben and Paolo have been discussing moving existing code that we implement in C to the managed world, as our JIT is in some cases as good as the C compiler and the transition from managed to unmanaged is too costly: we can now move more code into the managed world.

The old gcc exceptions mechanism that the Mono JIT used for a long time to speedup calls into the unmanaged world is gone. It was too much of a support nightmare (gcc and libc would often be out of sync, rendering the optimization useless), and instead Zoltan has cooked up some ways to improve the transition cost on x86 and SPARC.

Ports

The PowerPC port got a big boost today with various fixes checked in from Paolo; Neale continues to update the S390 port and Zoltan has checked in some fixes to support Linux on the SPARC (in addition to Solaris).

We still need to support the Itanium and the x86-64 CPUs (if you have a good recommendation about a book on these platform, please mail me) as they are important platforms for SUSE.

Thread.Abort and File locking

Lluis completed this week the Thread.Abort implementation for Mono. Our old implementation had various issues if we aborted thread while we were in unmanaged code (since there was no way to clean things up). Lluis' new implementation now shuts down things properly.

Now this might seem like a problem that few people would run into, but the reality is that it happened a lot with people using ThreadPools, ASP.NET or WebRequests since all of them triggered a call to Thread.Abort, and the side effects were ugly: from assertions in the runtime, to hangs at program exit.

This fixes the last major reliability blocker problem we had for Mono 1.0.

Dick in the meantime implemented the locking functionality for Files, a feature that some people needed and that was not really there before.

Xslt Joshua and documentation

Joshua has checked in the tools to produce HTML out of Monodoc. Real men use Monodoc, but if you feel like giving up on your manhood, now you can browse uncompressed, not-as-beautiful, not-indexed classes ;-)

Marek. Martin. Raja

They are rapidly closing the last pending bugs in the MCS compiler, none of them are crucial, but we want to ship with as few bugs as possible in the compiler. At this point, we are no longer accepting large changes to the compiler (which also means that Anonymous Methods will just not make it into the 1.0 release, too bad, they were too cute).

Posted on 22 May 2004