Closing over the loop variable considered harmful, part two
(This is part two of a two-part series on the loop-variable-closure problem. Part one is here.) UPDATE: We are taking the breaking change. In C# 5, the loop variable of a foreach will be logically...
View ArticleDebunking another myth about value types
Here’s another myth about value types that I sometimes hear: “Obviously, using the new operator on a reference type allocates memory on the heap. But a value type is called a value type because it...
View ArticleWhat is the defining characteristic of a local variable?
If you ask a dozen C# developers what a “local variable” is, you might get a dozen different answers. A common answer is of course that a local is “a storage location on the stack”. But that is...
View ArticleOut parameters and LINQ do not mix
What’s wrong with this code? var seq = new List { "1", "blah", "3" }; int tmp; var nums = from item in seq let success = int.TryParse(item, out tmp) select success ? tmp : 0; The intention …...
View ArticleDynamic contagion, part two
This is part two of a two-part series on dynamic contagion. Part one is here. Last time I discussed how the dynamic type tends to spread through a program like a virus: if an expression of dynamic type...
View ArticleLowering in language design, part one
Programming language designers and users talk a lot about the “height” of language features; some languages are considered to be very “high level” and some are considered to be very “low level”. A...
View ArticleReal world async/await defects
Today I’m once again asking for your help. The headliner feature for C# 5 was of course the await operator for asynchronous methods. The intention of the feature was to make it easier to write...
View ArticleWhat is up with transparent identifiers? Part one
A query expression in C# is, as you probably know, just a syntactic sugar for a bunch of method calls. For example, from customer in customers where customer.City == "London" select customer.LastName...
View ArticleWhat is up with transparent identifiers? Part two
This will be my last post before I head off for my annual vacation in Canada; see you again in September for more Fabulous Adventures in Coding! Last time on FAIC I suggested a rule for translating...
View ArticleFunctional programming for beginners
Happy New Year everyone; I hope you had a pleasant and relaxing festive holiday season. I sure did. I’m starting the new year off by giving a short — an hour long or so — talk on how you can … Continue...
View Article
More Pages to Explore .....