The Old New Thing

The gradual erosion of the car trip experience

How will kids today learn to get along with their siblings? I just learned that another of the basic childhood conflict resolution scenarios has disappeared, thanks to the dual-screen DVD player and entertainment system for your car, so each kid can remain content without the burden of having to interact with their annoying brother or sister...

The implementation of iterators in C# and its consequences (part 3)

I mentioned that there was an exception to the general statement that the conversion of an iterator into traditional C# code is something you could have done yourself. That's true, and it was also a pun, because the exception is exception handling. If you have a try ... finally block in your iterator, the language executes the finally ...

The implementation of iterators in C# and its consequences (part 2)

Now that you have the basic idea behind iterators under your belt, you can already answer some questions on iterator usage. Here's a scenario based on actual events: I have an iterator that is rather long and complicated, so I'd like to refactor it. For illustrative purposes, let's say that the enumerator counts from 1 to 100 twice. (In ...

The unwritten rule of riding a Seattle Metro bus

The Metro King County transit site has all the facts about how to ride the bus, but there's another rule that is applied by convention rather than by any formal codification: For some reason, and I see this only in Seattle, it is customary to say Thank you to the bus driver as you get off the bus. Tip for new riders: If you aren't ...

The implementation of iterators in C# and its consequences (part 1)

Like anonymous methods, iterators in C# are very complex syntactic sugar. You could do it all yourself (after all, you did have to do it all yourself in earlier versions of C#), but the compiler transformation makes for much greater convenience. The idea behind iterators is that they take a function with yield return statements (and ...

If the law says you can’t file a petition, you might need to file it anyway, in case somebody later says that you should’ve even though the law says you couldn’t

It sounds like a scene from the movie Brazil, but in fact it's the law. Let's rewind a bit. The introduction is a bit technical, but I'll try to keep it short. There is a legal filing known as a habeas petition and another known as a petition for review. There are rules regarding what each one covers and the deadlines for filing them. ...