Some code patterns I don’t love in C#.

Pattern 1: TryGetFoo that returns boolean. MyEnum ret;if (Enum.TryParse<MyEnum>(normalized, true, out ret)) { return ret; } else { return null; } You would think this slightly more concise line would work MyEnum ret;return Enum.TryParse<MyEnum>(str, true, out ret) ? ret : null; But it turns out that is no good. Compiling the ternary operator, compiler can’t…

2

Azure Web Roles + RoleShared. Grrrrr…

I had a deployment to azure failing yesterday, and I thought ‘I know what caused this. It’s a dll dependency break from upgrading to Azure SDK 2.3.’ Of course I was right. But looking at how I was getting screwed by the new sdk switch, I felt surprised at the mechanisms involved. Of course first…

0

The lexer hack

I found recently I like to do the coding more slowly and intersperse more reading than was once the case before the internet was large. The internet is frickin huge now. Try finding what you are looking for. Anyway, I roughly found what I was looking for today in ‘the lexer hack’ http://en.wikipedia.org/wiki/The_lexer_hack So what…

0

Scripting vs module systems…

A well known pain point of the CLR is that loading your program and running a few lines takes too long. While I don’t know where exactly my beliefs came from, my beliefs are that this is because of a) assemblies needing to be JITTED from MSIL in order to executeb) in order to JIT…

0

More tokenizing…

So I flippantly said ‘write a helper function that captures the right pattern for tokenizing’ last post… But when you sit down to think about it, a helper function feels like the opposite of what you logically do when you are implementing a finite state machine… because there is no way to have helper functions be case…

0

In which I try to write a tokenizer, and fail…

I reread something by Steve Yegge, which I think was his NBL thing. Anyway, he said something to the effect of ‘writing a programming language will make you a better programmer’. And I thought ‘Really? Well, why not. Practicing any sort of programming probably helps, but if you’re also doing that kind of introspection maybe…

0