Re:Inner class syntax suggestion

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Re:Inner class syntax suggestion

Martin Lafaix

> From: "dIon Gillard" <[hidden email]>
> >- It makes no provision for anonymous classes;
> Why not? The name doesn't have to be there...

Ouch!  It looks like you are adding yet another concept: a
structure returning a value.  While I have nothing against this
concept in general, it does not exist in NetRexx, and is
inconsistent with the current specs.

[Or, if I did not understood your proposition correctly, how
 would you implement the following Java code:

  private Vector history = new Vector()

  public void match(Observable o) {
    o.addObserver(new Observer() {
      public void update(Observable o, Object arg) {
        history.addElement(arg);
      }
    });
  }

 I'm particularly interested to see your suggestion for the
 o.addObserver statement...]

> Hmmm....end [name] is used for loops...and if inner classes are to be put
> anywhere in a class, you'll need some way to delimit the class and the
> outer one.

Yes.  It's one of the problems raised by your suggestion.

> >- No way to define 'static' inner classes without adding yet another
> >  special case (something like a 'static' keyword that you can only use
> >  in 'nested' classes);
> Unfortunately, this is the way Java inner static classes work. I'd suggest
> it to be the default.

Ouch again :-)  At least the 'static' keyword was already present
in NetRexx (not for classes, but for methods).  Now you are
suggesting the addition of yet another keyword/concept:
'nonstatic'...

> So, you're saying that inner CLASSES should be implemented as a METHOD?
> This is a little confusing and inconsistent.

We already have methods returning classes (Class.forName, the
getClass all objects have, etc.).  What I'm suggesting is a method
returning a type.  Such methods will surface the day Java will add
dynamic classes anyway.

That's the only addition I'm suggesting.

> length? Could you explain how 'length' is a psuedo member?

Probably a poor choice of word from my part.  I was referring to
the usage of 'length' with arrays.  It's not a real method in this
case.  Same thing for the usage of 'class' with types:

  foo=char[7]
  say foo.length
  obj=String.class
  say obj.isInterface /* would say '0' */

> >Then again, please note I'm not asking for inner classes to be added in
> >NetRexx (beyond being able to access them, that is).
> I am...I would prefer that NetRexx could do what Java could.

I would prefer NetRexx not to be contaminated with the design
flaws present in the Java language.  There is no need for it.


Martin
--
[hidden email]
Team OS/2
http://wwwi3s.unice.fr/~lafaix/os2.html

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To unsubscribe from this mailing list ( ibm-netrexx ), please send a note to
[hidden email]
with the following message in the body of the note
unsubscribe ibm-netrexx <e-mail address>

Reply | Threaded
Open this post in threaded view
|

Re: Re:Inner class syntax suggestion

Mr Antoon Verhoeven



On Sat, 17 Jan 1998, Scott Pollard wrote:

>
> There is already so much that can be done using NetRexx, that there must be
> a point at which additional 'functionality' ceases to be beneficial to the
> vast majority, adds complexity that puts off new users and adds to the
> development workload -- thus precluding (perhaps) Mike from working on
> something new and even better??!!

My 2 cents opinion is that inner classes belong in NetRexx, because
otherwise a strong selling point for Netrexx to the Java community (and
that is a big one) is broken. This selling point ( for me at least ) is
that any piece of Java source code can be translated more or less directly
into netrexx.

I read software books with Java code examples, and learn from and use
source code examples written in  Java. That's OK because i know that
transformation into NetRexx is straightforward. When inner classes become
widespread, the situation changes.
Even when i don't like inner classes, i still would like to have *all*
my source code in NetRexx, and not some parts with inner classes in Java
just because NetRexx doesn't support them. This would complicate my source
management considerably.

Isn't it possible to include inner classes in NetRexx with minimal hassle
for beginners who don't care / know about inner classes ? Probaly only a
single new keyword , something like "endclass" may have be added to the
base (beginner) syntax. This keyword could even be optional in
non-innerclass syntax.
 
I learnt from this thread that there is much more to bringing inner
classes into NetRexx than that, but i hope i made my point that inner
classes would not necessarily add complexity for beginners, and second
that inner classes *are* indispensable to avoid NetRexx from becoming
labeled as a 'crippled Java for beginners'.

Even the not-so-elegant-but-easy alternative of inline Java source
for inner classes within netrexx classs files  would be appreciated as a
solution for this problem as long as all source code remains in '.nrx'
files.

I suspect the last word hasn't been said on this subject..

May NetRexx enlighten your coding,

Toon.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Toon Verhoeven

Postgraduate Student & Heavy NetRexx user
Intelligent Systems lab, School of Applied Science
Nanyang Technological University

The HyperMap Project - Spatial HyperMedia over the Internet
http://mars.sas.ntu.ac.sg:7777/hm2
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To unsubscribe from this mailing list ( ibm-netrexx ), please send a note to
[hidden email]
with the following message in the body of the note
unsubscribe ibm-netrexx <e-mail address>