Friday, March 22, 2013

Lessons Learned

A preliminary C# expression for the Toyl model in Fig. 10.1 is now posted on github.

I rewrote this sucker about five times before I landed on the revision currently posted.  What did I learn?

First, I found ways to use delegates to represent lambda expressions instead of creating separate classes for each one.  That made the code a lot smaller and a lot tidier.

Second, in the case of currying and creating higher order functions, I found a way to define "delegate factories" that would generate the delegates I needed.

I'm actually pretty happy with the resulting code.  In the next post, I will disassemble it and see what it looks like in CIL.

No comments:

Post a Comment