*OR* is the ONLY way, to extend class Rexx, to do the INITIALIZATION
*only* in My classes 'Stem' and 'Wordlist, and then: Would NetRexx *allow* the notation of: MyStem = Stem -- initlialized to '' in MyClass Stem MyList= WordList -- inilialied to '' in MyClass WordList and then, for instance: loop i=1 to 13 if Mystem[i] = 'abc' then .... end--loop What I'm seeking for, desparately, is a NOTATION *in the original* Declaration whether a Rexx Variable is a Rexx String, a Rexx Stem (called INDEXED String in NetRexx), *or* a (Blank separated) WordList, or a (comma separated) ChoiceList (comma acts as the separator), As a matter of fact, I would like to EXTEND class REXX to clarify the purpose in my programs (at the first DECLARATION POINT) :-) Is there any way to accomplish this in NetRexx, please ? Any advise will be warmly appreciated! Full stop. Thomas. -- Thomas Schneider (www.thsitc.com) _______________________________________________ Ibm-netrexx mailing list [hidden email]
Thomas Schneider, Vienna, Austria (Europe) :-)
www.thsitc.com www.db-123.com |
Thomas,
Re extending Rexx, I'm looking forward to a definitive answer from MFC, Rene, et al. In the meantime I tried compiling the "program" Class ExtendRexx Extends Rexx which produced the message "-Error: I think this might mean that Rexx is a Final class. At least I hope so, because allowing it to be extended sounds to me like setting the stage for mind boggling mischief.-A default constructor, 'ExtendRexx()', is needed, but the immediate superclass constructor 'Rexx()' is not accessible -Compilation of 'ExtendRexx.nrx' failed [one error]" George On Sat, Apr 16, 2011 at 7:07 PM, Thomas Schneider <[hidden email]> wrote: *OR* is the ONLY way, to extend class Rexx, to do the INITIALIZATION *only* in My classes _______________________________________________ Ibm-netrexx mailing list [hidden email] |
Hello George,
1.) Thanks for you valuable input. 2.) May I, please. explain expplain clearly *why* I would like to extend the class Rexx: a) I would like to DISTINGUISH simple NetRexx Rexx Strings and 'indexed Strings' (formerly called Stem's) in my Property definitions. Currently, I'm doing that by always appending a line comment (Note), for instace: item_name = Rexx '' /*Stem!*/ -- the name of the items variables I would prefer to use the notation: item_name = Stem (and be able to use Stem as a Type (class)) But, I would like to retain the '[' ... ']' notation, as currently used in NetRexx, as, for instance import com.thsitc.pp.rt.Items class Myclass uses Items ... loop ii=1 to 13 e_name=item_name[ii].left(30) -- build the edited name e_class=item_class[ii]..left(10) -- build edited (short) class name e_parent=Item_parent[i].left(20) -- build edited parent (long name of package containing this class) ... etc, etc end--loop b) similarly, I would like to define a WorList (Blank delimited List of words) as a Datatype, etc, etc I did have some discussions with Mike about this, my desire, years ago, when I did develop Rexx2Nrx back in 2002, as far as I can remember but actually did forget the pro's, con's etc. I wanted to implement this (when the community would agree) in the Netrexx OPEN SOURCE as my first contribution, but ... I'm raising this questions in this forum, becaus I want to discuss this idea, in this broad forum of Netrexx experts. I'll wait for Rene's and Mike's replies, if any, of course now. cheers from Vienna, Thomas. =========================================== Am 17.04.2011 03:57, schrieb George Hovey: Thomas, --
Thomas Schneider (www.thsitc.com) _______________________________________________ Ibm-netrexx mailing list [hidden email]
Thomas Schneider, Vienna, Austria (Europe) :-)
www.thsitc.com www.db-123.com |
Thomas,
it is entirely possible, you have to override all its constructors though. this: class RexxSubClass extends Rexx method RexxSubClass(in=char)
super(in) method RexxSubClass(in=char[]) super(in) method RexxSubClass(in=java.lang.String) super(in) method RexxSubClass(in=java.lang.String[])
super(in) method RexxSubClass(in=Rexx) super(in) method RexxSubClass(in=boolean) super(in) method RexxSubClass(in=byte) super(in)
method RexxSubClass(in=short) super(in) method RexxSubClass(in=int) super(in) method RexxSubClass(in=long) super(in) method RexxSubClass(in=float)
super(in) method RexxSubClass(in=double) super(in) compiles without error on my system. best regards, René.
On Sun, Apr 17, 2011 at 2:22 PM, Thomas Schneider <[hidden email]> wrote:
_______________________________________________ Ibm-netrexx mailing list [hidden email] |
Hello Rene,
thansk for the clarification :-) Hello Mike, Rene: WHY, please ? Thomas. PS: I, at the minute, will wait *for sure* until I could have the opportunity to look at Mike's original NetRexx SOURCE code, to be able to fully understand, why he did what! Meanwhile, I would like to inform you that I will proceed with my OWN NetRexx Compiler. The first, planned, release will be, however, only Netrexx1 compatible (as those are the only parts of the NetRexx Language I do currently use, due to a lack of more deep knowledge of basic OO principles (in my brain, at least)). Thomas. ========================================================================== Am 17.04.2011 22:53, schrieb René Jansen: Thomas, --
Thomas Schneider (www.thsitc.com) _______________________________________________ Ibm-netrexx mailing list [hidden email]
Thomas Schneider, Vienna, Austria (Europe) :-)
www.thsitc.com www.db-123.com |
On 18 April 2011 04:54, Thomas Schneider <[hidden email]> wrote:
It's not a mystery; the implicit constructor of the Rexx class [Rexx()] is not a public method and in order to inherit form some other class you need access to your super-class's constructors some how in order for them to initialize themselves when your sub-class is instantiated. Making the implicit constructor invisible to the public interface of a class is usually a design issue and is quite common; it often makes no sense to create an object via the implicit constructor and I suspect that the Rexx class is one of those cases. Hence in order to create a subclass of Rexx you need to choose a "public" constructor from the [Rexx] super-class to invoke during object instantiation. You could choose to invoke just one of the Rexx constructors but this would make little sense for a general purpose class (it may make perfect sense for some specific specializations so don't count that out either) hence René's suggestion that you need to overload all the Rexx constructors.
The Rexx class is not part of the Rexx compiler, it's part of the Rexx run-time and as such is pure Java with all the rules and restrictions placed upon any java class. You don't need access to the source to understand these concepts; it has nothing to do with how Mike wrote the Rexx compiler, Class inheritance is an object oriented programming concept. What you do need is a thorough understanding of object oriented programming and in particular the inheritance model. An understanding of Java wouldn't hurt either. Alan. -- Can't tweet, won't tweet! _______________________________________________ Ibm-netrexx mailing list [hidden email]
Alan
-- Needs more cowbell. |
Alan,
Why is class Rexx extensible? George On Mon, Apr 18, 2011 at 12:10 PM, Alan Sampson <[hidden email]> wrote:
_______________________________________________ Ibm-netrexx mailing list [hidden email] |
On 18 April 2011 11:33, George Hovey <[hidden email]> wrote: Alan, The glib answer is because it isn't marked Final, but I'm the wrong person to ask; I didn't design the interface. In general though there are few reasons not to allow any class to be extended to add your own specializations. It's part of OO code re-usability. Alan. -- Can't tweet, won't tweet! _______________________________________________ Ibm-netrexx mailing list [hidden email]
Alan
-- Needs more cowbell. |
Thanks. I'm NOT an OO whiz, and I wondered if I was missing out on some compelling use for this.
On Mon, Apr 18, 2011 at 3:08 PM, Alan Sampson <[hidden email]> wrote:
_______________________________________________ Ibm-netrexx mailing list [hidden email] |
Another reason is that it makes it easier to write testcases
for the Rexx class. And I think it probably helped during
development (e.g., trying out a different version of a Rexx method without
modifying the Rexx class itself).
Mike
_______________________________________________ Ibm-netrexx mailing list [hidden email] |
Free forum by Nabble | Edit this page |