[#5563] Non-overridable and non-redefinable methods — Eric Mahurin <eric_mahurin@...>

Lately, I've been thinking about the future of ruby

44 messages 2005/08/19
[#5564] Re: Non-overridable and non-redefinable methods — Austin Ziegler <halostatue@...> 2005/08/19

On 8/19/05, Eric Mahurin <eric_mahurin@yahoo.com> wrote:

[#5571] Re: Non-overridable and non-redefinable methods — Eric Mahurin <eric_mahurin@...> 2005/08/19

--- Austin Ziegler <halostatue@gmail.com> wrote:

[#5574] Re: Non-overridable and non-redefinable methods — TRANS <transfire@...> 2005/08/20

Just wanted to add a few things.

[#5581] Re: Non-overridable and non-redefinable methods — Austin Ziegler <halostatue@...> 2005/08/20

On 8/19/05, TRANS <transfire@gmail.com> wrote:

[#5583] Re: Non-overridable and non-redefinable methods — "David A. Black" <dblack@...> 2005/08/20

Hi --

[#5585] Re: Non-overridable and non-redefinable methods — Eric Mahurin <eric_mahurin@...> 2005/08/20

--- "David A. Black" <dblack@wobblini.net> wrote:

[#5609] Pathname#walk for traversing path nodes (patch) — ES <ruby-ml@...>

Here is a small addition to Pathname against 1.9, probably suited

20 messages 2005/08/22

Re: Non-overridable and non-redefinable methods

From: Eric Hodel <drbrain@...7.net>
Date: 2005-08-20 20:31:59 UTC
List: ruby-core #5588
On 20 Aug 2005, at 02:05, Eric Mahurin wrote:

> Seems like I've seen somewhere referring to Matz discouraging
> redefining core class methods.

I've found discouragement in ruby to be something entirely different  
than making these things an absolute impossibility.  For example:

$ cat y.rb
block = proc { }
def foo(*x) 5 end
def bar(&b) end

foo (1 + 1)
foo ()
bar &block

def foo(x) 5 end

foo *[1]

[ ~ ]
[13:26] drbrain@kaa$ ruby -w y.rb
y.rb:5: warning: (...) interpreted as grouped expression
y.rb:6: warning: don't put space before argument parentheses
y.rb:7: warning: `&' interpreted as argument prefix
y.rb:11: warning: `*' interpreted as argument prefix
y.rb:9: warning: method redefined; discarding old foo

I like warnings, they're gentle.

Also, by naming.  instance_variable* looks very clumsy because you  
usually can't get away with chaining of ivar set/get in 80  
characters.  ObjectSpace.each_object (that doesn't include  
Enumerable, which can be truly annoying when you want to exploit it).

I like that ruby makes discouraged things look ugly over than one  
that forces me not to do things.

I don't think ruby would be ruby anymore with your proposed changes.

-- 
Eric Hodel - drbrain@segment7.net - http://segment7.net
FEC2 57F1 D465 EB15 5D6E  7C11 332A 551C 796C 9F04


In This Thread