This works in Ruby:

  class Integer
    def hello ()
      puts self
    end
  end

  5.hello() # outputs 5

For performance reasons there is a slight bit of cheating for some
numerical types.  For example you cannot add a method to the number 5
only.  See http://ruby-doc.org/core-2.1.4/Fixnum.html for details.

On Sun, Nov 2, 2014 at 3:18 PM, Bill Ricker <[email protected]> wrote:
> On Sun, Nov 2, 2014 at 5:39 PM, Ben Tilly <[email protected]> wrote:
>>> Do smalltalkers accept Ruby's claims?  Their native OO is more OO than
>>> P5's (but we have choices), but is arithmetic really done with messages?
>>
>> Yes.  Ruby's OO model is an exact copy of Smalltalk's.  Arithmetic
>> works the same way once you get past the syntactic sugar.
>
>
> So in Ruby, 3 natively handles metaobject methods ?
>
> --
> Bill Ricker
> [email protected]
> https://www.linkedin.com/in/n1vux

_______________________________________________
Boston-pm mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to