Forum: Ruby Kernel#blah is documented as Object#blah. Why?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Bb5ac46e606a18c60e08dee578294e1a?d=identicon&s=25 Alex Fortuna (dadooda)
on 2009-02-18 17:35
Hi guys.

There are certain common methods that originate from module Kernel, but
they're documented in class Object.

E.g.

> o = Object.new
> => #<Object:0xb76826c8>
> o.method :send
> => #<Method: Object(Kernel)#send>

method's #inspect clearly shows that #send originates from Kernel, but:

$ ri Kernel#send
Nothing known about Kernel#send
$ ri Object#send
(ri page on #send)

Why this kind of confusion? Why not making methods like #send, #kind_of?
and a bunch of others *ACTUALLY* belong to Object, thus making
method.inspect() more accurate in terms of pointing to the proper place
in the documentation?
Ef3aa7f7e577ea8cd620462724ddf73b?d=identicon&s=25 Rob Biedenharn (Guest)
on 2009-02-18 18:04
(Received via mailing list)
On Feb 18, 2009, at 11:34 AM, Alex Fortuna wrote:
>> o.method :send
> Why this kind of confusion? Why not making methods like #send,
> #kind_of?
> and a bunch of others *ACTUALLY* belong to Object, thus making
> method.inspect() more accurate in terms of pointing to the proper
> place
> in the documentation?


Or use a different program for searching the ri docs, like fastri

$ fri Kernel#send
------------------------------------------------------------ Object#send
      obj.send(symbol [, args...])        => obj
      obj.__send__(symbol [, args...])    => obj
------------------------------------------------------------------------

It even helps with things like:
$ fri send
------------------------------------------------------ Multiple choices:

      Net::SSH::Transport::OutgoingPacketStream#send,
      Net::SSH::UserAuth::Pageant::Socket#send, Object#send,
      Resolv::DNS::Requester::ConnectedUDP::Sender#send,
      Resolv::DNS::Requester::TCP::Sender#send,
      Resolv::DNS::Requester::UnconnectedUDP::Sender#send,
      SOAP::HTTPStreamHandler#send, UDPSocket#send

http://rubyforge.org/projects/fastri/

-Rob

Rob Biedenharn    http://agileconsultingllc.com
Rob@AgileConsultingLLC.com
+1 513-295-4739
Skype:  rob.biedenharn
8f6f95c4bd64d5f10dfddfdcd03c19d6?d=identicon&s=25 Rick Denatale (rdenatale)
on 2009-02-18 18:16
(Received via mailing list)
On Wed, Feb 18, 2009 at 12:03 PM, Rob Biedenharn
<Rob@agileconsultingllc.com
> wrote:

> It even helps with things like:
> $ fri send
> ------------------------------------------------------ Multiple choices:
>
>     Net::SSH::Transport::OutgoingPacketStream#send,
>     Net::SSH::UserAuth::Pageant::Socket#send, Object#send,
>     Resolv::DNS::Requester::ConnectedUDP::Sender#send,
>     Resolv::DNS::Requester::TCP::Sender#send,
>     Resolv::DNS::Requester::UnconnectedUDP::Sender#send,
>     SOAP::HTTPStreamHandler#send, UDPSocket#send


And as the name implies, it's MUCH faster than ri, unless ri has made
significant progress in that area since I pretty much stopped using it
for
fri, or it's alter ego qri

--
Rick DeNatale

Blog: http://talklikeaduck.denhaven2.com/
Twitter: http://twitter.com/RickDeNatale
Bb5ac46e606a18c60e08dee578294e1a?d=identicon&s=25 Alex Fortuna (dadooda)
on 2009-02-18 18:18
Rob,

Well, using alternative ri implementations might be a way out.

However, for me the point isn't me not being able to find where #send is
documented. ri also supports various kinds of listings etc.

The point is trying to figure out why certain methods are documented in
(supposedly) wrong places, and, if possible, find ways to fix that. That
way we'll found a solid base for misc reflection-based doc solutions.

I'm currently writing a hack that relies upon reflection to
automatically find where the documentation is. For Rails & other gems it
works perfectly. For base Ruby -- well, one of the issues is the topic
of this post. :)
Fbb4d027695dfdf76bf448b15d7e306a?d=identicon&s=25 matt neuburg (Guest)
on 2009-02-18 21:15
(Received via mailing list)
Rob Biedenharn <Rob@AgileConsultingLLC.com> wrote:

> >> => #<Object:0xb76826c8>
> >
> > Why this kind of confusion? Why not making methods like #send,
> > #kind_of?
> > and a bunch of others *ACTUALLY* belong to Object, thus making
> > method.inspect() more accurate in terms of pointing to the proper
> > place
> > in the documentation?
>
>
> Or use a different program for searching the ri docs, like fastri

Fastri has been broken for months OMM.

$ fri Object
(druby://127.0.0.1:50026) /usr/local/lib/ruby/1.8/yaml.rb:133:in
`transfer': invalid subclass (TypeError)
        from (druby://127.0.0.1:50026)
/usr/local/lib/ruby/1.8/yaml.rb:133:in `node_import'
        from (druby://127.0.0.1:50026)
/usr/local/lib/ruby/1.8/yaml.rb:133:in `load'
        from (druby://127.0.0.1:50026)
/usr/local/lib/ruby/1.8/yaml.rb:133:in `load'
        from (druby://127.0.0.1:50026)
/usr/local/lib/ruby/1.8/rdoc/ri/ri_descriptions.rb:72:in `deserialize'
        from (druby://127.0.0.1:50026)
/usr/local/lib/ruby/site_ruby/1.8/fastri/ri_index.rb:354:in `get_class'
        from (druby://127.0.0.1:50026)
/usr/local/lib/ruby/site_ruby/1.8/fastri/ri_index.rb:354:in `open'
        from (druby://127.0.0.1:50026)
/usr/local/lib/ruby/site_ruby/1.8/fastri/ri_index.rb:354:in `get_class'
        from (druby://127.0.0.1:50026)
/usr/local/lib/ruby/site_ruby/1.8/fastri/ri_index.rb:352:in `each'
        from (druby://127.0.0.1:50026)
/usr/local/lib/ruby/site_ruby/1.8/fastri/ri_index.rb:352:in `get_class'
        from (druby://127.0.0.1:50026)
/usr/local/lib/ruby/site_ruby/1.8/fastri/ri_service.rb:209:in `info'
        from (druby://127.0.0.1:50026)
/usr/local/lib/ruby/site_ruby/1.8/fastri/ri_service.rb:422:in
`capture_stdout'
        from (druby://127.0.0.1:50026)
/usr/local/lib/ruby/site_ruby/1.8/fastri/ri_service.rb:208:in `info'
        from /usr/local/bin/fri:342
        from /usr/local/bin/fri:337:in `each'
        from /usr/local/bin/fri:337

m.
This topic is locked and can not be replied to.