Java
Levi Pearson
levi at cold.org
Tue Feb 13 16:19:40 MST 2007
On 2/13/07, Michael Torrie <torriem at chem.byu.edu> wrote:
> From what I've read, they are bytecodes to allow the changing of a class
> on the fly. Adding methods, removing methods. The problem is that this
> seems to sort of shoe-horn small-talk style OOP into the rigid,
> Java-style OOP, which is really borrowed from how C++ implemented it.
> Smalltalk doesn't really have a concept of a class and a class instance.
> Rather everything is an object that listens for and can send messages.
> The messages themselves are analogous to Java methods. Python, for
> example, merely implements a __getattr__ method on every object that can
> be user-defined to bring this smalltalk-like behavior to python. So I
> wonder how well it will solve this problem. .NET's CLR seems to have
> bested the JVM in the dynamic realm. IronPython runs amazingly well on
> it currently.
I'm not sure what you mean when you say that Smalltalk doesn't have a
concept of a class and a class instance. Smalltalk actually has a
very well-developed concept of classes, though classes are indeed
objects as well. Every object has a class, which is an object of its
own metaclass. Metaclasses are also objects, and have a class as
well, etc. Thus, while everything is still an object, there are also
classes and instances. Here's a page that describes it, with some
diagrams that really help make it comprehensible:
http://www.ifi.unizh.ch/richter/Classes/oose2/05_Metaclasses/02_smalltalk/02_metaclasses_smalltalk.html
It's Self, which is a derivative of Smalltalk, that eschews the
class/instance distinction and instead uses a prototype-based form of
inheritance. This is similar to how Javascript does things.
While Java has the concept of classes, if I recall correctly it does
not treat them as fully-fledged objects, and I certainly don't recall
a concept of metaclass in Java.
--Levi
More information about the PLUG
mailing list