[#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:18202] Re: New array methods cycle, choice, shuffle (plus bug in cycle)

From: "Florian Frank" <flori@...>
Date: 2008-08-08 15:33:49 UTC
List: ruby-core #18202
Gregory Brown wrote:
>> Kernel#rand is not callable as a method:
>>
>> ruby -e "[1,2,3].rand"
>> -e:1: private method `rand' called for [1, 2, 3]:Array (NoMethodError)
>>
>> So this argument would only affect methods calling rand from within instance
>> methods on Array or subclasses of it. I think the danger of overwriting
>> Kernel#rand in a way that would break user code is pretty low.
>>     
>
> I don't think it's terribly unlikely that someone will have a subclass
> like this:
>
> class Array
>   def rand
>     "o hai"
>   end
> end
>
> class Foo < Array
>   def bar
>     rand(20)
>   end
> end
>   
Something like that is, what I had in mind.
> puts Foo.new.bar
>
>
> But since I pretty much loathe the idea of subclassing core classes, I
> don't mind breaking them :)
>
>   
Reopening classes, mixing in and extending objects suffer from the same 
problem. Essentially this makes it impossible to get random numbers in 
any case, that tries to use arrays in any of these ways. You cannot 
predict, if some library, that is pulled in later will fail, because it 
(reasonably) expects to use the old Kernel#rand in this context. It's 
better to leave Kernel instance methods alone, unless one actually 
intends to tinker with them - and then it's better to adhere to their 
known calling protocol.

-- 
Florian Frank

In This Thread