11 April 2009

liquid syntax

i've been playing with more expressive syntax in c# today, trying to be more ruby since that avenue is blocked for me.
2.Days().After(9.May(2005)).Should(Be.EqualTo(11.May(2005)));
them's alotta parens. i've been toying mostly with dates and testing syntax. thankfully, the nunit guys did most of the work for me on the latter point. i've also found it's fairly easy to eliminate some of the standard duplication in .net, for example, raising events always requires a null check on the delegate. not anymore.
Click.Raise(this);
while c# still lacks much of the flexibility and beauty of ruby (from what i know of it), it should be possible to achieve many of the same niceties.

No comments:

Post a Comment