[rspec-users] Down with Lambda!!

David Chelimsky dchelimsky at gmail.com
Sat Nov 17 19:02:18 EST 2007


On Nov 17, 2007 5:59 PM, aslak hellesoy <aslak.hellesoy at gmail.com> wrote:
> On Nov 18, 2007 12:40 AM, 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?
>
> Probably not. There was a longer discussion of it here:
> http://rubyforge.org/tracker/index.php?func=detail&aid=13837&group_id=797&atid=3152
>
> As you point out, creating an alias is a one-liner.
> The main reason I don't want to add it is that lambda is a common
> idiom, and I don't want to set precedence of aliasing core Ruby idioms
> just because some people don't like the ones in Ruby.

+1

David

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


More information about the rspec-users mailing list