It is truly an object oriented language... no hybrid datatypes!
When I gave it a glance a while back, it didn't look like you could
subclass or extend the built-in classes. Did I read that wrong?
Or am I just confusing it with that so-called OO language being hyped by Sun? {grin}
-- Randal L. Schwartz, Perl hacker
| [reply] [Watch: Dir/Any] |
The following code will output Ruby is a great language!
a="Perl"
def a.+ other
"Ruby"+other
end
a+=" is a great language!\n"
So, ruby does actually allow you to extend and redefine it's built-classes.. the example also works if you define a new class which inherits String, instead of using singleton style inheritance.. I have not however tested this with every built-in class, but those I have tried it with, worked fine!
Or am I just confusing it with that so-called OO language being hyped by Sun? {grin}
He he... probably... I have had alot of beginners getting really confused over the hybrid style of Java... | [reply] [Watch: Dir/Any] [d/l] |
Having looked at it recently I think that there may be a
couple of exceptions. Specifically
Fixnum.
However since that is just an internal representation of
Integer
I don't think there is any practical limitation there.
| [reply] [Watch: Dir/Any] |
Heh, no, Ruby is much more dynamic than that :) You can subclass, extend, etc. to your heart's desire.
| [reply] [Watch: Dir/Any] |