[ruby 1.8.4] bug: power! does not work then works in irb

hi.

here is a session in irb:
irb(main):001:0> 10.power!(200)
NoMethodError: undefined method `power!' for 10:Fixnum
        from (irb):1
irb(main):002:0> help Fixnum
=> nil
irb(main):003:0> 10.power!(200)
=>
100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
irb(main):004:0> quit

so a call to help Fixnum makes the power! method to be available ?

i use slackare 10.2 with a self-made package of ruby 1.8.4 compiled with
CFLAGS="-O2 -march=$arch -mcpu=i686" \
CXXFLAGS="-O2 -march=$arch -mcpu=i686"\
./configure --prefix=/usr --enable-shared
make
make install DESTDIR=$pkg
make install-doc DESTDIR=$pkg

on an Athlon XP 1800+

# note:
not all people on #ruby-lang on irc.freenode.net got that error

I just tried this on Osx and got the same result!

Keith

···

On 4/9/06 8:19 AM, "solsTiCe d'Hiver" <solstice.dhiver@laposte.net> wrote:

hi.

here is a session in irb:
irb(main):001:0> 10.power!(200)
NoMethodError: undefined method `power!' for 10:Fixnum
        from (irb):1
irb(main):002:0> help Fixnum
=> nil
irb(main):003:0> 10.power!(200)
=>
100000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000
irb(main):004:0> quit

so a call to help Fixnum makes the power! method to be available ?

i use slackare 10.2 with a self-made package of ruby 1.8.4 compiled with
CFLAGS="-O2 -march=$arch -mcpu=i686" \
CXXFLAGS="-O2 -march=$arch -mcpu=i686"\
./configure --prefix=/usr --enable-shared
make
make install DESTDIR=$pkg
make install-doc DESTDIR=$pkg

on an Athlon XP 1800+

# note:
not all people on #ruby-lang on irc.freenode.net got that error

Hi,

You probably saw my reply on IRC but for others...

hi.

here is a session in irb:
irb(main):001:0> 10.power!(200)
NoMethodError: undefined method `power!' for 10:Fixnum
        from (irb):1
irb(main):002:0> help Fixnum
=> nil

This is actually a valid call. To see what help is from try:

method :help

You might get something like:

#<Method: Object(IRB::ExtendCommandBundle)#help>

The part in () tells us that it is from IRB... a quick check shows
that a trail is started
that eventually leads to:

require 'mathn'

That file in turn, does something like:

alias power! **

The reason not all people got the error is because some were probably
loading other code at startup or before testing. Rubygems is an
example of this.

Moral of the story is to be away of what your ruby environment
automatically brings in.

Brian.

···

2006/4/9, solsTiCe d'Hiver <solstice.dhiver@laposte.net>:

Hi,

At Sun, 9 Apr 2006 22:19:23 +0900,
solsTiCe d'Hiver wrote in [ruby-talk:188278]:

here is a session in irb:
irb(main):001:0> 10.power!(200)
NoMethodError: undefined method `power!' for 10:Fixnum
        from (irb):1

power! is for internal use only. Do not use.

···

--
Nobu Nakada

I get the same behavior .. using ruby on Windows XP ... the binary distribution

···

----- Original Message ----- From: "solsTiCe d'Hiver" <solstice.dhiver@laposte.net>
To: "ruby-talk ML" <ruby-talk@ruby-lang.org>
Sent: Sunday, April 09, 2006 9:19 AM
Subject: [ruby 1.8.4] bug: power! does not work then works in irb

hi.

here is a session in irb:
irb(main):001:0> 10.power!(200)
NoMethodError: undefined method `power!' for 10:Fixnum
       from (irb):1
irb(main):002:0> help Fixnum
=> nil
irb(main):003:0> 10.power!(200)
=>
100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
irb(main):004:0> quit

so a call to help Fixnum makes the power! method to be available ?