From: Trans Date: 2005-09-16T04:01:35+09:00 Subject: Re: you can't get in trouble with your boss for picking C# Florian Gro� wrote: > John wrote: > > > There is nothing to set C# apart from Java, except for the impossibly > > huge .NET framework for developing a billion different kinds of > > applications. > > Please, have a look at > http://taubz.for.net/blog?entry=http://taubz.for.net/blog/blog-6956298/dd7d1bf8-3fcd-4a3a-8fba-d4dca0c5da12 > > How can a language where you can write this be as bad as Java? > > var old_numbers = new [] {1, 2, 3, 4}; > // And yes, I still don't like arrows. :/ > var new_numbers = old_numbers.map(number => { number * 2 }); > > True, this is not possible just yet, but C# 2 already introduced > features like yield return and delegate(int x) { return x * 2; } that > are a huge step away from the simple mindedness of Java. Had to do it. require 'blankslate' class Delegate < BlankSlate def initialize( obj, &yld ) @obj = obj @yld = yld end def method_missing( sym, *args, &blk ) if @yld @yld[ @obj ].__send__( sym, *args, &blk ) else @obj.__send__( sym, *args, &blk ) end end end module Kernel def delegate( obj, &yld ) Delegate.new( obj, &yld ) end end if $0 == __FILE__ i1 = 1 i2 = delegate( i1 ) { |x| x*2 } p i2 puts i2 end