[1071] in java-interest

home help back first fref pref prev next nref lref last post

ST/Objc "perform:" and Java

daemon@ATHENA.MIT.EDU (Mike Fleming)
Thu Aug 17 23:55:26 1995

From: Mike Fleming <mikef@xnet.com>
To: java-interest@java.sun.com
Date: Thu, 17 Aug 1995 10:45:37 -0500 (CDT)

Gee, it seems to me that the discussion on this list has completely
degenerated into "How come java isn't just like my favorite language?"
However, I think there are some issues here.

Frankly, I don't care about operator overloading.  What I DO care about is
the ability to dynamically send messages to objects.  In C, you have
function pointers.  In Objective-C and Smalltalk, you have selectors.
In java, you have NOTHING.

My personal opinion is that this is only of the most glaring imperfections
in Java.  In Objective-C, one of the coolest things is List's
makeObjectsPerform:.  Smalltalk class libraries have even neater Collection
methods that allow you to make all the objects perform a specific selector,
returning a list of objects in the Collection for which the selector
evaluated true.  But the usefulness of selectors goes well beyond this.

For example, I want a Sorted List class.  In Smalltalk or Objective C,
I could essentially say "list sortWithMethod: <some method>".  I can
easily resort the list by choosing a different method.  In Java, my best
chance is to create an interface with a "sort()" function that has
a parameter for different sorting styles.

This is just the beginning.  As other people have mentioned on this list,
selectors are tremendously useful when used with a GUI layout program
that allows you to connect between objects.  The whole of NEXTSTEP is
build upon the concept of a target object and an action method.  You
can dynamically assign the action method.

I think that the ability to dynamically call functions/methods is valuable.
The question now is: does this violate the security principles of Java?
I'm not sure.  The "great danger" is that one can call any method in
any object you can get ahold of.  But you can do that anyway.  I can't
see how this can possibly upset the security of the runtime system.

The last time I brought up a language extension (Categories) some people
commented on whether it could be a security hole.  I think there's still
a lot of confusion about the whole security issue.  I know I'm a little
bit confused over Sun's goals for security in the class library.  Is there
someone in the know who can comment on whether this would really be a security
problem?

Mike Fleming

-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post