[rspec-users] Down with Lambda!!

David Chelimsky dchelimsky at gmail.com
Sat Nov 17 19:01:47 EST 2007

On Nov 17, 2007 5:40 PM, Steven Garcia <lists at ruby-forum.com> wrote:
> Rspec is all about using natural language to define behavior. In this
> context, I feel that lambda is sorely out of place. I was chatting on
> #irc and a pal of mine (wycats) proposed an interesting alternative:
> alias_method :doing, :lambda
> so instead of something like
> lambda {post :create, {:title => nil}}.should
> raise_error(ActiveRecord::RecordInvalid)
> we get
> doing {post :create, {:title => nil}}.should
> raise_error(ActiveRecord::RecordInvalid)
> Now it reads like a sentence..much cleaner and less abstract to those of
> us who are not Ruby wizards (yet)
> Chatting with other folks and they are hyped on the idea.
> What do you guys think?
> Any chance we could get something like this into trunk?

We've been through this a few times on this list. There's a
fundamental difference between replacing "assert_equal" with "should
equal" and replacing lambda with anything at all. assert_equal is a
method that a Ruby programmer wrote into a library. lambda is part of
the Ruby language. We're still writing Ruby here, aren't we?

Of course, you're free to alias whatever you like in your own
projects. We're still writing Ruby here, aren't we!!!


> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users

More information about the rspec-users mailing list