[rspec-devel] [Proposed Refactoring] - Current ExampleSpace class subclasses Test::Unit::TestCase
Jim Deville
james.deville at gmail.com
Wed Aug 22 23:53:20 EDT 2007
On Aug 22, 2007, at 4:44 PM, Jay Levitt wrote:
> On 8/22/2007 6:06 PM, Scott Taylor wrote:
>>>>> It's more like the ! ruby methods. It's dangerous, there is a non
>>>>> dangerous alternative and you should know precisely what you're
>>>>> doing.
>>>>> (perhaps we should rename it before! to follow that convention).
>>>> I always thought that that was a LISP/Scheme convention - the
>>>> question mark signifying a boolean return value, and the
>>>> exclamation
>>>> point signifying an "unsafe" function - unsafe in the Haskell/
>>>> functional way of thinking (i.e. change the state of an object).
>>>> Obviously Ruby isn't a functional language, so I've always been a
>>>> little bit curious as to what is considered "dangerous".
>>>
Ruby isn't fully a functional language, but it pulls in from the
Functional Paradigm, in addition to it's LISPish inspirations.
>>> I don't think of ! as dangerous. To me it means "do this to
>>> yourself."
>>> When you say list.reject { ... } you get a new list back with the
>>> appropriate items removed. When you say list.reject! { ... }, those
>>> items are actually removed from the list you're sending the message
>>> to. Make sense?
>>
>> So I guess you do understand it as "dangerous" - that is, in the
>> functional sense - of modifying the data your working on. But this
>> would make most methods in ruby ! methods.
>
> David A. Black posted a great blog entry about this last week:
>
> http://dablog.rubypal.com/2007/8/15/bang-methods-or-danger-will-
> rubyist
>
> Jay
>
> _______________________________________________
> rspec-devel mailing list
> rspec-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-devel
More information about the rspec-devel
mailing list