[1381] in java-interest
Re: The need for "perform" in Java & instanc
daemon@ATHENA.MIT.EDU (Smiljan Grmek - KSI ZGB)
Thu Aug 31 13:22:02 1995
Date: Thu, 31 Aug 1995 16:01:30 +0200 (MET DST)
From: Smiljan Grmek - KSI ZGB <sgrmek@public.srce.hr>
To: Mike Christiansen <mikec@metronet.com>
cc: java-interest@java.sun.com
In-Reply-To: <mikec.335.05030B40@metronet.com>
On Sat, 30 Sep 1995, Mike Christiansen wrote:
> I see the need for smalltalk-like perform: and perform:with: operations.
> These are needed to implement several useful patterns which are found in
> ParcPlace Smalltalk and in the patterns book. For example, Adaptors map the
>
> In fact this begs the larger question of how instance specific behavior
> is to be implemented in Java. Each instance of an Adaptor is initialized with
Apparently the Java design team took a firm stance on this one. Methods
can not be invoked by their (string) names. This closes a significant
security loophole. For instance, if I have a class to manage my own
files, and if this class is available to the interpeter at run-time, then
any imported method could potentially find the name of 'cleanFileSystem'
method and invoke it just to see what it does. The defintion of Java
insists that methods called are defined.
You can get around this by using interface definitions but it makes
trying out various method names a compile-time exercise - too costly to
hack.
A way of producing generalized code is by using interfaces - this ensures
that objects are willing to be treated in required general way.
A *very* useful Smalltalk ability to pass code segments around is also
missing from Java - fair trade for security.
Smiljan Grmek
KSI Zagreb
Croatia
-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com