would result in two different criteria, which is not the case. “crit2 is the original criteria where age is 19” makes sense, but I would not expect that to update crit1.
I don’t mind mutability per se, but it needs to be clear what data is mutable and when it is mutated.
Re:Method chaining and lazy evaluation in Ruby
by JoelMcCracken on Monday November 28, 2011 @02:21PM
(#3287180)
It seems obvious to me that this would be how to implement this. When I read his initial code, I immediately wondered why he wasn't returning self.
Maybe this familiarity comes with having spent enough time reading through the jQuery internals. Speaking of which, if you like this article, the classic "10 things I learned from the jQuery source" is great reading:
Re:Method chaining and lazy evaluation in Ruby
by jarin on Monday November 28, 2011 @10:19AM
(#3286158)
This is a pretty good bite-size sampling of the workings of some of the nice things we take for granted in Rails (like AREL). Rspec is another one that's worth looking into:
Re:Method chaining and lazy evaluation in Ruby
by jkreeftmeijer on Monday November 28, 2011 @10:35AM
(#3286228)
Thanks! I totally agree RSpec's a good library to dive into too. To understand how it works, I wrote Raptor (https://github.com/jeffkreeftmeijer/raptor) a while back. I might write about that too, sometime. :)
Re:Method chaining and lazy evaluation in Ruby
by bphogan on Monday November 28, 2011 @10:23AM
(#3286173)
I really enjoyed that. It's something I wish I knew early in my Ruby programming experience. I've done similar things on my own but I really appreciated the approach taken here.
I don’t mind mutability per se, but it needs to be clear what data is mutable and when it is mutated.
Maybe this familiarity comes with having spent enough time reading through the jQuery internals. Speaking of which, if you like this article, the classic "10 things I learned from the jQuery source" is great reading:
http://paulirish.com/2010/10-things-i-learned-from-the-jquer...
http://stackoverflow.com/questions/3105755/ruby-metaprogramm...