From: "D. Deryl Downey" Date: 2013-03-18T13:13:53+09:00 Subject: Re: confusion with singleton method call This is a multi-part message in MIME format. --------------000707050703070503050102 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Think about it. You're trying to define directly on a NUMBER, even though its class is BigNum, numbers can't have singletons assigned to them. Now if you did class << BigNum that'd be different. Same thing for when you attempt to assign to a symbol. Now if you did class << Symbol that'd be different. Dude, if you're going to try complex stuff like this, use your friggin head. You keep attempting to do dumb ass stuff, but don't have a clue to what you're doing. You're not thinking, nor even attempting to reason it out. It didn't dawn on you that NUMBERS are different than their base class? What good would defining a singleton on the number 11 do? NOTHING! > Love U Ruby > March 17, 2013 11:39 PM > Can anyone help me here? > > Love U Ruby > March 14, 2013 1:38 PM > C:\>irb --simple-prompt > DL is deprecated, please use Fiddle >>> class Foo >>> def talk >>> p "huanng" >>> end >>> end > => nil >>> module Bar >>> def talk >>> p "hunnggg" >>> end >>> end > => nil >>> foo = Foo.new > => # >>> class<< foo >>> def talk >>> super >>> return >>> p "hukkangg" >>> end >>> include Bar >>> end > => #> > > part - A > >>> foo.talk > "hunnggg" > => nil > > Part - B > >>> foo.class.instance_method(:talk).bind(foo).call > "huanng" > => "huanng" > > Can anyone help me to understand the difference between the two call to > `talk`? or How part B bypass the call to singleton method `talk` to > class Foo s `talk` ? > -- D. Deryl Downey "The bug which you would fright me with I seek" - William Shakespeare - The Winter's Tale, Act III, Scene II - A court of Justice. --------------000707050703070503050102 Content-Type: multipart/related; boundary="------------030407030204060905030702" --------------030407030204060905030702 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit Think about it. You're trying to define directly on a NUMBER, even though its class is BigNum, numbers can't have singletons assigned to them. Now if you did class << BigNum that'd be different.

Same thing for when you attempt to assign to a symbol. Now if you did class << Symbol that'd be different.

Dude, if you're going to try complex stuff like this, use your friggin head. You keep attempting to do dumb ass stuff, but don't have a clue to what you're doing. You're not thinking, nor even attempting to reason it out. It didn't dawn on you that NUMBERS are different than their base class? What good would defining a singleton on the number 11 do? NOTHING!


March 17, 2013 11:39 PM
Can anyone help me here?

March 14, 2013 1:38 PM
C:\>irb --simple-prompt
DL is deprecated, please use Fiddle
class Foo
def talk
p "huanng"
end
end
=> nil
module Bar
def talk
p "hunnggg"
end
end
=> nil
foo = Foo.new
=> #<Foo:0x20493c0>
class << foo
def talk
super
return
p "hukkangg"
end
include Bar
end
=> #<Class:#<Foo:0x20493c0>>

part - A

foo.talk
"hunnggg"
=> nil

Part - B

foo.class.instance_method(:talk).bind(foo).call
"huanng"
=> "huanng"

Can anyone help me to understand the difference between the two call to
`talk`? or How part B bypass the call to singleton method `talk` to
class Foo s `talk` ?


--
D. Deryl Downey

 "The bug which you would fright me with I seek" - William Shakespeare - The Winter's Tale, Act III, Scene II - A court of Justice.
--------------030407030204060905030702 Content-Type: image/jpeg; x-apple-mail-type=stationery; name="compose-unknown-contact.jpg" Content-Transfer-Encoding: base64 Content-ID: Content-Disposition: inline; filename="compose-unknown-contact.jpg" /9j/4AAQSkZJRgABAQEARwBHAAD/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEC AQEBAQEBAgICAgICAgICAgICAgICAgICAgICAgICAgICAgL/2wBDAQEBAQEBAQICAgICAgIC AgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgL/wAAR CAAZABkDAREAAhEBAxEB/8QAGAAAAwEBAAAAAAAAAAAAAAAABgcICQr/xAA0EAABAwMCAgUK BwAAAAAAAAACAQMEBQYRABITIQcUMUF2CBUXIjI2N0JRtVRWkZOV0dL/xAAYAQEAAwEAAAAA AAAAAAAAAAADAAEEAv/EACQRAAICAAQGAwAAAAAAAAAAAAABAhEDMrHREyExM0FxgfDx/9oA DAMBAAIRAxEAPwDuEt+gW/ULet6oVC3rfqNQqFv0OfPn1GhUqfOmzZtKZlS5UqZMaNwzNwiJ VIl7eXLCaZIGwBl3TY8epPx2+jy2ZNPjvkwc9uhW8j7nCPhvOsQliYIeS7cvCpp8o50qwrC4 v3lsNSDbdmTEhvs2tahxpfV3WnmbbozJEw/gwdadbYExVRXKEKoSdvJcaOSqxE7/AAiX0gXx +a69/JSf9alIlste0VzaNpeFrcT9KKymotyiaZ0KRCnzacoE7Kjzn4gi2KqUh3jqDHDHv4mR UfruTWlMzlVUKIVNp9GguEJnAh0+IZjyAiisgyRDnu5azS8miKqjOTVkKqS/psG37fo1Fbab eg25b8eZPeFJBBJSjMG5HjMeyihnaauZwe4OGiju13GAcpOwBeN+U8/IkGbsiS8b7ryogmbz hbyc9REROfZhERO5ETShjPtvpGqTUyLErytS4siSwx5x2tRH4hPOI0DkjZtaJtFxuVEbIUUi yeNujlBUJGbJN6nM/Cyf2Hf60YgjvKA+NPSP4gT7axpcPtr51YWJnYn9dnAQWl722p4ot37y zqnlfp6FrqbwawG8/9k= --------------030407030204060905030702-- --------------000707050703070503050102--