March 28, 2003

C# may do closures now

Joys of scanning for referrers in the weblog. Following through from here leads to an indication that C# does do closures in some way, and through it to another link that indicates that they're looking to add them to .NET. I'm not sure if C# does 'em now (there was no indication in any of my .NET or C# books that I found, but I might've missed it) but it looks like they're being added.

I suppose, but it looks like the .NET folks are going to be trading speed for kitchen-sinkery.

Their performance, I suppose. As long as they're not laboring under the illusion that Moore's Law actually holds.

Posted by Dan at March 28, 2003 03:27 PM | TrackBack (1)
Comments

I'm writing my first C# program and i'd really like to know why there are no function-valued variables or local anonymous function definitions. Instead they have a half-baked thing called Delegates.

What I do is emulate them with private classes (which do exist) but that is ridiculously verbose. E.g. if you want to pass a predicate (a function that takes an object of some type and returns a Boolean) to a function as an argument you have to declare a separate Predicate class for each predicate you ever want to pass to that function. Sinc ethe C# perople seem to be smart I'm sure there are hidden language design considerations that led to their exclusion, but as someone who was taught programming in Algol 68, which had this stuff in 1968, I can't help but feel disappointed and crippled by C#s lack of support for this.

Posted by: Reinier at August 17, 2004 04:42 AM

I'm writing my first C# program and i'd really like to know why there are no function-valued variables or local anonymous function definitions. Instead they have a half-baked thing called Delegates.

What I do is emulate them with private classes (which do exist) but that is ridiculously verbose. E.g. if you want to pass a predicate (a function that takes an object of some type and returns a Boolean) to a function as an argument you have to declare a separate Predicate class for each predicate you ever want to pass to that function. Since the C# people seem to be smart I'm sure there are hidden language design considerations that led to their exclusion, but as someone who was taught programming in Algol 68, which had this stuff in 1968, with proper static typechecking too, I can't help but feel disappointed and crippled by C#s lack of support for this. Perhaps 2.0 will do it right.

Posted by: Reinier at August 17, 2004 04:49 AM