There's one feature of other languages like C++ and Java I really miss
in ooRexx.  In Java, an instance of a class can access non-public
methods and fields of another instance of the same class.  ooRexx has
PRIVATE methods, but access to those methods is limited to calls from
the within the same object (via a call to self~whatever).  If two
instances of a class need to share data, there's no protected way to
do this.  It's necessary to define things with publlic access, and you
then need to trust that nobody will misuse the access.

I have a simple proposal (and code...a surprisingly small amount of
code) for expanding the usable scope of PRIVATE methods:

A PRIVATE method can be invoked from any of the following situations:

1)  The caller is a method of the same object as the target (i.e.,
invoked via self~whatever).  This is the same as today.
2)  The caller is an instance of the same class that defined the
target method (the method's scope).  This will allow an instance of a
class invoke a private method of another instance of the same class.
3)  The caller is a class object that is compatible with the scope of
the method.  This allows class objects to also access private methods
of its own instances.  Useful for specialized class methods that
create instances (such as the "fromXxxxxx" methods on DateTime).

I have the code written for this, but because it's such a change in
behavior, I thought this should get some discussion on the list first.

Rick

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Oorexx-devel mailing list
Oorexx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-devel

Reply via email to