[#18121] [Ruby 1.8.7 - Bug #405] (Open) ssl.rb:31: [BUG] Bus Error — Anonymous <redmine@...>

Issue #405 has been reported by Anonymous.

14 messages 2008/08/04

[#18130] Re: New array methods cycle, choice, shuffle (plus bug in cycle) — Brian Candler <B.Candler@...>

> Seriously though... Array.first is a noun.

10 messages 2008/08/05

[#18319] NEW Command: absolute_path() -- — "C.E. Thornton" <admin@...>

Core,

14 messages 2008/08/16
[#18321] Re: NEW Command: absolute_path() -- — Yukihiro Matsumoto <matz@...> 2008/08/18

Hi,

[#18381] [Bug #496] DRb.start_service(nil) is very slow — Hongli Lai <redmine@...>

Bug #496: DRb.start_service(nil) is very slow

11 messages 2008/08/25

[ruby-core:18176] Re: New array methods cycle, choice, shuffle (plus bug in cycle)

From: "David A. Black" <dblack@...>
Date: 2008-08-07 20:45:19 UTC
List: ruby-core #18176
Hi --

On Fri, 8 Aug 2008, David Flanagan wrote:

> David A. Black wrote:
>
>> I also agree with something I think you said before, which is that
>> sample! as described here seems to be doing two things. Usually the
>> "danger" of the bang fits very well with the receiver-changing
>> behavior of arrays (plus the secondary danger of the nil return). But
>> it's a stretch, I think, to think of a sampling as a removal
>> operation. It feels a bit like having first! remove the first element.
>
> I don't really get the objection to using a bang in the name, though. While 
> its not strictly parallel, I can't see it confusing anyone.  I'm replying to 
> David's comment about this, though, because when I was trying to put together 
> an argument *for* sample!, I was going to use a hypothetical first! as an 
> example: it seems to me that anyone who was familiar with Ruby method naming 
> conventions would understand that first!, if it existed, worked just like 
> shift.  first! and last! would certainly be easier for new programmers who 
> haven't already been introduced to terms like shift and pop.  (I'm not asking 
> to add these methods--just saying that they seem perfectly reasonable to me!)

I don't see first and last as being just a ! away from being
destructive. I wouldn't expect there to be a destructive at! method
either. I think it has something to do with the fact that these
methods don't do anything to the array in the first place, so the leap
to doing that (nothing) destructively seems too great.

By contrast, all of the existing array bang methods (sort!, reverse!,
collect!, compact!, reject!, map!, slice!, flatten!, uniq!) all
perform transformations on the array, with the possible except of
slice which sounds kind of destructive already. Going from, say,
reversing a dup to reversing the object itself seems like a smaller
and smoother step than going from referring to an element to removing
that element permanently.

Come to think of it, they're all verbs, while first, last, and at
aren't. That may be the heart of it.


David

-- 
Rails training from David A. Black and Ruby Power and Light:
  *  Advancing With Rails    August 18-21    Edison, NJ
  * Co-taught by D.A. Black and Erik Kastner
See http://www.rubypal.com for details and updates!

In This Thread

Prev Next