Fat-Free Templating with Barebones Javascript

Today I’m going to demonstrate a straight-forward and very effective technique for markup templating.  I’ve borrowed the supplant prototype function from Douglas Crockford’s – And Then There Was Javascript presentation, in order to show you how to inject values from custom data structures directly into into strings.  We’ll be doing a minimal implementation here inContinue reading “Fat-Free Templating with Barebones Javascript”

Implementing method_missing with C# dynamic – Part 2

In my previous post, Implementing method_missing with C# dynamic – Part 1, I demonstrated a simple approach to plugging a method_missing call routing seam into a DynamicObject.  Here I’ll take it a step further to implement a generic method_missing function capable of passing any call to a forwarding context object.  Note that I do notContinue reading “Implementing method_missing with C# dynamic – Part 2”

Implementing method_missing with C# dynamic – Part 1

One of the neat things about Ruby is its method_missing fallback capability.  Using the C# 4.0 DynamicObject, we’re also able to control dispatch at runtime.  I wanted to see how the method_missing idiom might work with a C# dynamic dispatcher, so I wrote up a small sample. [TestMethod] public void Can_Control_Dynamic_Dispatch() {     dynamic dispatcher1Continue reading “Implementing method_missing with C# dynamic – Part 1”