Java Lambdas and NetRexx

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

Java Lambdas and NetRexx

gustavo_mindreau
Dear members,
Once again I need help with NetRexx  :-(
I was looking in Amazon for a book entitled "NetRexx for dummies", but I did not find any...  ;-)
Perhaps I should write one with easy examples for the left gifted among us (like myself).

I have two example Java programs:

JAVA_WithLambda.java                         (in JAVA 8)
        class JAVA_WithLambda
         {
          public static void main(String[] args)
           {
            Runnable r = () -> System.out.println("and Lambda in Java works...");
            r.run();
           }
         }
 
JAVA_WithoutLambda.java                 (in JAVA 7)
        class JAVA_WithoutLambda
         {
          public static void main(String[] args)
            {
             Runnable r = new Runnable()
               {
                public void run()
                  {
                   System.out.println("and JAVA still works without Lambdas...");
                  }
               };
             r.run();
            }
        }        

How would one achieve to translate this example (WithoutLambda) into NetRexx 3.06 ?
Thank you beforehand for any help and suggestions.  And have a nice weekend.

Best regards,
Gus
_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Lambdas & NetRexx - future...

gustavo_mindreau
Dear Mr. Woodman,
Once again thank you for your answer.
Your example is very clear and it works.

Now:  to the creators and maintainers of NetRexx.
I have a couple of questions/requests, that have been triggered by this Lambda experience.
Yes, Lambda expressions can be emulated in NetRexx with 'minor and dependent classes'.  But is this desirable?

From the NetRexx documentation:  "NetRexx is designed for people, not computers."
If this is true, Lambda expressions should be implemented in NetRexx, like other NetRexx functions: in an easy way.
If you look at the code needed in order to implement Lambda, that is "not" easy.  At least as far (as newbie) as I can see.

There are also two operations (that come into my mind) that are not implemented in NetRexx, but they should:
1-  increment operators ++  (i++)   They exist in C++ and in Java.  
2-  bitwise operators.  I can invert bits with an XOR, and I can shift bits with multiplication/division by 2**n.  Nevertheless a specific operator should be easier.

NetRexx, a great REXX dialect (it still is!), was born more than 20 years ago.  But times have changed, so has the JVM and its users.
NetRexx was great as an scripting language, but can be, and probably is, used in more serious projects nowadays.
Please do consider these points (and probably others) when perhaps planning a NetRexx 4.0 release.

We still do want a language designed for people, not machines, and NetRexx is for this, just great!  
(where is Mr. Cowlishaw, the REXX company hero of 30 years ago, when he is needed?  :-)

Sincerely,
Gus





"Dave Woodman" <[hidden email]>
Sent by: [hidden email]

2018-01-13 01:19

Please respond to
IBM Netrexx <[hidden email]>

To
"'IBM Netrexx'" <[hidden email]>,
cc
Subject
Re: [Ibm-netrexx] Java Lambdas and NetRexx





Hi Gus,
 
In NetRexx we cannot do an in-line subclass – instead we have to specify what is referred to as a “dependent class” as a separate class definition.
 
So, something along the lines of
 
class NetRexx_WithoutLambda public
                method NetRexx_WithoutLambda
                                runme().run
                               
              method main($cmdin1=String[]) static;arg=Rexx($cmdin1)
                             me = NetRexx_WithoutLambda()
     
class NetRexx_WithoutLambda.runme dependent implements Runnable
                method run
                                say "and NetRexx works without Lambdas..."
                                                                                                                                                             
might be what you are looking for.
 
         Dave.                    

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: Lambdas & NetRexx - future...

Rony G. Flatscher

Hi Gus,

just a little remark ad lambdas and Java: as you probably know lambdas are implemented as normal Java classes that need to implement normal Java interface classes from the Java function package (<https://docs.oracle.com/javase/8/docs/api/java/util/function/package-summary.html>), e.g. cf. <https://docs.oracle.com/javase/tutorial/java/javaOO/lambdaexpressions.html>.

The easiness with which one can employ lambdas functions in Java relates directly to the Java compiler doing a lot of helpful stuff behind the curtain, supporting lambda related syntax sugar and doing extensive (and great!) type inferences. Therefore many chained lambdas functions in Java look so simple and clean. Behind the curtain the Java compiler will create the necessary classes to satisfy Java. The Java compiler people have been doing really a very, very nice job at that, but ...

... there are some (maybe not so obvious) catches here:

  • there are more and more complex lambda chains that are unintelligible upfront, if you were not the original author or have not worked with these chains for a longer time; in this case the APL-phenonemon may pop up: one can solve the most complex problems very elegantly with quite a few lines of code, sometimes for the price that you do not understand your own code after a while, :)

  • following the discussions in some of the OpenJDK lists (where Java evolves from version to version and where the super experts discuss) quite often lambdas are presented to make a point, but if they are complex, then it may be the case that you will find additional informal documentations of what these Lambdas actually do and what Lambda functions really get deployed and why.

Of course you are right, any Rexx version has to be "designed for people, not computers"! The challenge with lambdas is to come with a syntax that is self-describing and allows for clearly finding the functional Java interface class that is being employed, such that any inferral from NetRexx is straight-forward and the resulting code again legible at all times.

As you have been digging deeper and deeper into these interesting Java areas, maybe you could come up with some ideas or designs that would make it easy for NetRexx programmers to employ Java lambdas in the future?  Any idea or suggestion would be highly welcome, I am sure!

---rony



On 13.01.2018 15:18, [hidden email] wrote:
Dear Mr. Woodman,
Once again thank you for your answer.
Your example is very clear and it works.

Now:  to the creators and maintainers of NetRexx.
I have a couple of questions/requests, that have been triggered by this Lambda experience.
Yes, Lambda expressions can be emulated in NetRexx with 'minor and dependent classes'.  But is this desirable?

From the NetRexx documentation:  "NetRexx is designed for people, not computers."
If this is true, Lambda expressions should be implemented in NetRexx, like other NetRexx functions: in an easy way.
If you look at the code needed in order to implement Lambda, that is "not" easy.  At least as far (as newbie) as I can see.

There are also two operations (that come into my mind) that are not implemented in NetRexx, but they should:
1-  increment operators ++  (i++)   They exist in C++ and in Java.  
2-  bitwise operators.  I can invert bits with an XOR, and I can shift bits with multiplication/division by 2**n.  Nevertheless a specific operator should be easier.

NetRexx, a great REXX dialect (it still is!), was born more than 20 years ago.  But times have changed, so has the JVM and its users.
NetRexx was great as an scripting language, but can be, and probably is, used in more serious projects nowadays.
Please do consider these points (and probably others) when perhaps planning a NetRexx 4.0 release.

We still do want a language designed for people, not machines, and NetRexx is for this, just great!  
(where is Mr. Cowlishaw, the REXX company hero of 30 years ago, when he is needed?  :-)

Sincerely,
Gus





"Dave Woodman" [hidden email]
Sent by: [hidden email]

2018-01-13 01:19

Please respond to
IBM Netrexx [hidden email]

To
"'IBM Netrexx'" [hidden email],
cc

Subject
Re: [Ibm-netrexx] Java Lambdas and NetRexx







Hi Gus,
 
In NetRexx we cannot do an in-line subclass – instead we have to specify what is referred to as a “dependent class” as a separate class definition.
 
So, something along the lines of
 
class NetRexx_WithoutLambda public
                method NetRexx_WithoutLambda
                                runme().run
                               
              method main($cmdin1=String[]) static;arg=Rexx($cmdin1)
                             me = NetRexx_WithoutLambda()
     
class NetRexx_WithoutLambda.runme dependent implements Runnable
                method run
                                say "and NetRexx works without Lambdas..."
                                                                                                                                                             
might be what you are looking for.
 
         Dave.                    


_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Lambdas... | future... | gorilla's

gustavo_mindreau
Well, there are users and users.  A colleague of me commented yesterday, "but why would you need to use Lambdas...".
I do not.  I am just an old fashioned programmer, a Structured Programming aficionado (and OOP hater), wanting to make WORA programs for the JVM.
When you learn a 'little' of Java it is rather easy to make simple NetRexx programs run with the extensive JAVA API.  So far so good.
But then you find JavaFX and want to expand your horizons from cmd line output to GUI.

Unfortunately the documentation in question (JavaFX) starts talking about Lambdas and their use with OnAction handlers.
Then you are stuck.  One solution is to find a way to interpret what those particular Lambdas are doing and then replace them with some clever, more simple and easier NetRexx code.
The other solution / alternative is: learn more JAVA !   And this implies learning OOP.  
And OOP, as I read, got all this implicit environment that they carry around with them. You wanted a banana but what you got was a gorilla holding the banana and the entire jungle.

No thank you.  I prefer Structured Programming; it is simple, elegant and "effective".
Besides, if you ever become efficient in Java to understand all those complicated constructions, and Lambdas, then why bother using NetRexx.  Stay then in Java as an specialist.
But that is not the original point, isn't it?  We want NetRexx, a language easy for "people"  (not only for dummies trying to find an uncomplicated User's Guide).
Anyway, thank you very much for sharing your insight with us.  Perhaps I should go back to Classic Rexx and only program for z/VM CMS :-(

Sincerely,
Gus





"Rony G. Flatscher" <[hidden email]>
Sent by: [hidden email]

2018-01-13 15:36

Please respond to
IBM Netrexx <[hidden email]>

To
IBM Netrexx <[hidden email]>,
cc
Subject
Re: [Ibm-netrexx] Lambdas & NetRexx - future...





Hi Gus,

just a little remark ad lambdas and Java: as you probably know lambdas are implemented as normal Java classes that need to implement normal Java interface classes from the Java function package (<https://docs.oracle.com/javase/8/docs/api/java/util/function/package-summary.html>), e.g. cf. <https://docs.oracle.com/javase/tutorial/java/javaOO/lambdaexpressions.html>.

The easiness with which one can employ lambdas functions in Java relates directly to the Java compiler doing a lot of helpful stuff behind the curtain, supporting lambda related syntax sugar and doing extensive (and great!) type inferences. Therefore many chained lambdas functions in Java look so simple and clean. Behind the curtain the Java compiler will create the necessary classes to satisfy Java. The Java compiler people have been doing really a very, very nice job at that, but ...

... there are some (maybe not so obvious) catches here:

  • there are more and more complex lambda chains that are unintelligible upfront, if you were not the original author or have not worked with these chains for a longer time; in this case the APL-phenonemon may pop up: one can solve the most complex problems very elegantly with quite a few lines of code, sometimes for the price that you do not understand your own code after a while, :)
  • following the discussions in some of the OpenJDK lists (where Java evolves from version to version and where the super experts discuss) quite often lambdas are presented to make a point, but if they are complex, then it may be the case that you will find additional informal documentations of what these Lambdas actually do and what Lambda functions really get deployed and why.
Of course you are right, any Rexx version has to be "designed for people, not computers"! The challenge with lambdas is to come with a syntax that is self-describing and allows for clearly finding the functional Java interface class that is being employed, such that any inferral from NetRexx is straight-forward and the resulting code again legible at all times.

As you have been digging deeper and deeper into these interesting Java areas, maybe you could come up with some ideas or designs that would make it easy for NetRexx programmers to employ Java lambdas in the future?  Any idea or suggestion would be highly welcome, I am sure!

---rony

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: Lambdas... | future... | gorilla's

Rony G. Flatscher

On 13.01.2018 18:37, [hidden email] wrote:
Well, there are users and users.  A colleague of me commented yesterday, "but why would you need to use Lambdas...".
I do not.  I am just an old fashioned programmer, a Structured Programming aficionado (and OOP hater), wanting to make WORA programs for the JVM.
When you learn a 'little' of Java it is rather easy to make simple NetRexx programs run with the extensive JAVA API.  So far so good.
But then you find JavaFX and want to expand your horizons from cmd line output to GUI.

Unfortunately the documentation in question (JavaFX) starts talking about Lambdas and their use with OnAction handlers.
Actually, there is no need to use lambdas to process an onAction event in an onAction handler! It seems that because lambdas are available, the Java people love to deploy lambdas wherever possible.

Then you are stuck.  One solution is to find a way to interpret what those particular Lambdas are doing and then replace them with some clever, more simple and easier NetRexx code.
The other solution / alternative is: learn more JAVA !   And this implies learning OOP.  
And OOP, as I read, got all this implicit environment that they carry around with them. You wanted a banana but what you got was a gorilla holding the banana and the entire jungle.
Well, this is some sort of a all or nothing proposition, which is not really true. Of course, if you want bananas, you need to be able to get the banana. Many times it is possible to get and eat it too, without going on a jungle expedition...

No thank you.  I prefer Structured Programming; it is simple, elegant and "effective".
Most programming languages, including Java, allow for structured programming.

Besides, if you ever become efficient in Java to understand all those complicated constructions, and Lambdas, then why bother using NetRexx. 
Because NetRexx is easier to use, hence more productive, especially for Rexx acquainted programmers.

Stay then in Java as an specialist.
This is your call, if your really got acquainted with Java in all details. However, in my case, I prefer to sit down and do quick and simple coding (using mostly ooRexx in my case for teaching purposes, but I admire NetRexx very much, therefore I built in support for NetRexx into BSF4ooRexx, the ooRexx-to-Java-bridge).

Once you have learned NetRexx and compare NetRexx programs then with Java programs you probably notice that NetRexx indeed is "simpler" to use and therefore more productive.

But that is not the original point, isn't it?  We want NetRexx, a language easy for "people"  (not only for dummies trying to find an uncomplicated User's Guide).
Anyway, thank you very much for sharing your insight with us.  Perhaps I should go back to Classic Rexx and only program for z/VM CMS :-(
Well, then you are bound in the fence that is there, rather than using NetRexx to reach out to all those (at times overwhelming) functionality Java offers and supplies for solving your problems on a mainframe in new ways and maybe more efficient as well.

If you have time why not come to the upcoming Rexx symposium which is, as I hear, planned at the end of March in the American hemisphere? This would enable you to get in touch with the people face-to-face and discuss and learn from the presentations, but also - sometimes even more important - off the presentation slots? And of course, we can reason about the jungle, the bananas and ways that make it easy to get at the bananas, being able to ignore the jungle it gets grown...

---rony


"Rony G. Flatscher" [hidden email]
Sent by: [hidden email]

2018-01-13 15:36

Please respond to
IBM Netrexx [hidden email]

To
IBM Netrexx [hidden email],
cc

Subject
Re: [Ibm-netrexx] Lambdas & NetRexx - future...







Hi Gus,

just a little remark ad lambdas and Java: as you probably know lambdas are implemented as normal Java classes that need to implement normal Java interface classes from the Java function package (<https://docs.oracle.com/javase/8/docs/api/java/util/function/package-summary.html>), e.g. cf. <https://docs.oracle.com/javase/tutorial/java/javaOO/lambdaexpressions.html>.

The easiness with which one can employ lambdas functions in Java relates directly to the Java compiler doing a lot of helpful stuff behind the curtain, supporting lambda related syntax sugar and doing extensive (and great!) type inferences. Therefore many chained lambdas functions in Java look so simple and clean. Behind the curtain the Java compiler will create the necessary classes to satisfy Java. The Java compiler people have been doing really a very, very nice job at that, but ...

... there are some (maybe not so obvious) catches here:

  • there are more and more complex lambda chains that are unintelligible upfront, if you were not the original author or have not worked with these chains for a longer time; in this case the APL-phenonemon may pop up: one can solve the most complex problems very elegantly with quite a few lines of code, sometimes for the price that you do not understand your own code after a while, :)
  • following the discussions in some of the OpenJDK lists (where Java evolves from version to version and where the super experts discuss) quite often lambdas are presented to make a point, but if they are complex, then it may be the case that you will find additional informal documentations of what these Lambdas actually do and what Lambda functions really get deployed and why.
Of course you are right, any Rexx version has to be "designed for people, not computers"! The challenge with lambdas is to come with a syntax that is self-describing and allows for clearly finding the functional Java interface class that is being employed, such that any inferral from NetRexx is straight-forward and the resulting code again legible at all times.

As you have been digging deeper and deeper into these interesting Java areas, maybe you could come up with some ideas or designs that would make it easy for NetRexx programmers to employ Java lambdas in the future?  Any idea or suggestion would be highly welcome, I am sure!

---rony


_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: Lambdas & NetRexx - future...

George Hovey-2
In reply to this post by Rony G. Flatscher
Hi Rony,

Thank you for that lucid insight.

I think there has been some common agreement in the past that NetRexx need not (and should not) ape Java's syntax feature-by-feature, but should always do a "cost-benefit" analysis, and if the feature seems desirable, find a simple, clear way to implement it.

I hope I'm not being cynical when I point out that Java is a pretty mature product with a large maintenance staff.  There may be a tendency to look for something to do.

You point out "The challenge with lambdas is to come [up] with a syntax that is self-describing and ... such that any inferral from NetRexx is straight-forward and the resulting code again legible at all times".

That Java lambdas require auxiliary documentation is a sign that their implementation does not meet your very reasonable requirement.  Virtually anything currently in NetRexx does, and anything added should.

I don't know what level of attention lambdas deserve, but I would like to see an approach to Regular Expressions that went beyond cryptic strings, something perhaps template-based, but at any rate showing an awareness of the limitations of human cognition.  That hasn't AFAIK come from the C-'nix axis powers.

I see from a search that you are well equipped to opine on these matters.  May I ask: do you use NetRexx.  

-- George

On Sat, Jan 13, 2018 at 9:36 AM, Rony G. Flatscher <[hidden email]> wrote:

Hi Gus,

just a little remark ad lambdas and Java: as you probably know lambdas are implemented as normal Java classes that need to implement normal Java interface classes from the Java function package (<https://docs.oracle.com/javase/8/docs/api/java/util/function/package-summary.html>), e.g. cf. <https://docs.oracle.com/javase/tutorial/java/javaOO/lambdaexpressions.html>.

The easiness with which one can employ lambdas functions in Java relates directly to the Java compiler doing a lot of helpful stuff behind the curtain, supporting lambda related syntax sugar and doing extensive (and great!) type inferences. Therefore many chained lambdas functions in Java look so simple and clean. Behind the curtain the Java compiler will create the necessary classes to satisfy Java. The Java compiler people have been doing really a very, very nice job at that, but ...

... there are some (maybe not so obvious) catches here:

  • there are more and more complex lambda chains that are unintelligible upfront, if you were not the original author or have not worked with these chains for a longer time; in this case the APL-phenonemon may pop up: one can solve the most complex problems very elegantly with quite a few lines of code, sometimes for the price that you do not understand your own code after a while, :)

  • following the discussions in some of the OpenJDK lists (where Java evolves from version to version and where the super experts discuss) quite often lambdas are presented to make a point, but if they are complex, then it may be the case that
    ​​
    you will find additional informal documentations of what these Lambdas actually do and what Lambda functions really get deployed and why.

Of course you are right, any Rexx version has to be "designed for people, not computers"!

​​
The challenge with lambdas is to come with a syntax that is self-describing and allows for clearly finding the functional Java interface class that is being employed,
​​
such that any inferral from NetRexx is straight-forward and the resulting code again legible at all times.

As you have been digging deeper and deeper into these interesting Java areas, maybe you could come up with some ideas or designs that would make it easy for NetRexx programmers to employ Java lambdas in the future?  Any idea or suggestion would be highly welcome, I am sure!

---rony



On 13.01.2018 15:18, [hidden email] wrote:
Dear Mr. Woodman,
Once again thank you for your answer.
Your example is very clear and it works.

Now:  to the creators and maintainers of NetRexx.
I have a couple of questions/requests, that have been triggered by this Lambda experience.
Yes, Lambda expressions can be emulated in NetRexx with 'minor and dependent classes'.  But is this desirable?

From the NetRexx documentation:  "NetRexx is designed for people, not computers."
If this is true, Lambda expressions should be implemented in NetRexx, like other NetRexx functions: in an easy way.
If you look at the code needed in order to implement Lambda, that is "not" easy.  At least as far (as newbie) as I can see.

There are also two operations (that come into my mind) that are not implemented in NetRexx, but they should:
1-  increment operators ++  (i++)   They exist in C++ and in Java.  
2-  bitwise operators.  I can invert bits with an XOR, and I can shift bits with multiplication/division by 2**n.  Nevertheless a specific operator should be easier.

NetRexx, a great REXX dialect (it still is!), was born more than 20 years ago.  But times have changed, so has the JVM and its users.
NetRexx was great as an scripting language, but can be, and probably is, used in more serious projects nowadays.
Please do consider these points (and probably others) when perhaps planning a NetRexx 4.0 release.

We still do want a language designed for people, not machines, and NetRexx is for this, just great!  
(where is Mr. Cowlishaw, the REXX company hero of 30 years ago, when he is needed?  :-)

Sincerely,
Gus





"Dave Woodman" [hidden email]
Sent by: [hidden email]

2018-01-13 01:19

Please respond to
IBM Netrexx [hidden email]

To
"'IBM Netrexx'" [hidden email],
cc

Subject
Re: [Ibm-netrexx] Java Lambdas and NetRexx







Hi Gus,
 
In NetRexx we cannot do an in-line subclass – instead we have to specify what is referred to as a “dependent class” as a separate class definition.
 
So, something along the lines of
 
class NetRexx_WithoutLambda public
                method NetRexx_WithoutLambda
                                runme().run
                               
              method main($cmdin1=String[]) static;arg=Rexx($cmdin1)
                             me = NetRexx_WithoutLambda()
     
class NetRexx_WithoutLambda.runme dependent implements Runnable
                method run
                                say "and NetRexx works without Lambdas..."
                                                                                                                                                             
might be what you are looking for.
 
         Dave.                    


_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/





--
"Life isn't one damn thing after another -- it's the same damn thing over and over."
  -- Edna St Vincent Millay

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: Lambdas & NetRexx - future...

Rony G. Flatscher

Hi George,

sorry, have overlooked your question, whether I use Netrexx.

The answer is: yes, from time to time.

As you may know I am a big user of ooRexx, which I like a lot and which I have been using in teaching successfully for almost 20 years. There is an ooRexx to Java bridge, which camouflages all of Java as ooRexx, such that ooRexx programmers become able to treat all of Java as if it was ooRexx. This package "BSF4ooRexx" that I have been developing over almost 17 years comes with numerous samples that demonstrate how one uses Java from ooRexx. There are Java samples as well to demonstrate how easy it is to employ ooRexx as a scripting language that interacts with the supplied Java objects from the Java side. All of these Java programs in the BSF4ooRexx samples directories have NetRexx counterparts, that I created for the purpose of demonstrating how one can use ooRexx from NetRexx.

Currently I am contemplating, once ooRexx 5.0 goes GA, to take advantage of the new RESOURCE-directive to allow storing NetRexx programs (either in source or base64'd as Java class files) that can be instrumentated, this time from ooRexx! Maybe writing a few lines of NetRexx code to be used in lambda statements, if the lambdas have to work on huge streams. Maybe a crazy idea, but one I am looking forward to discussing in person at the upcoming International Rexx symposium. So maybe you want to come, join and discuss possible new venues there?

Cheers,

---rony


On 14.01.2018 18:42, George Hovey wrote:
Hi Rony,

Thank you for that lucid insight.

I think there has been some common agreement in the past that NetRexx need not (and should not) ape Java's syntax feature-by-feature, but should always do a "cost-benefit" analysis, and if the feature seems desirable, find a simple, clear way to implement it.

I hope I'm not being cynical when I point out that Java is a pretty mature product with a large maintenance staff.  There may be a tendency to look for something to do.

You point out "The challenge with lambdas is to come [up] with a syntax that is self-describing and ... such that any inferral from NetRexx is straight-forward and the resulting code again legible at all times".

That Java lambdas require auxiliary documentation is a sign that their implementation does not meet your very reasonable requirement.  Virtually anything currently in NetRexx does, and anything added should.

I don't know what level of attention lambdas deserve, but I would like to see an approach to Regular Expressions that went beyond cryptic strings, something perhaps template-based, but at any rate showing an awareness of the limitations of human cognition.  That hasn't AFAIK come from the C-'nix axis powers.

I see from a search that you are well equipped to opine on these matters.  May I ask: do you use NetRexx.  

-- George

On Sat, Jan 13, 2018 at 9:36 AM, Rony G. Flatscher <[hidden email]> wrote:

Hi Gus,

just a little remark ad lambdas and Java: as you probably know lambdas are implemented as normal Java classes that need to implement normal Java interface classes from the Java function package (<https://docs.oracle.com/javase/8/docs/api/java/util/function/package-summary.html>), e.g. cf. <https://docs.oracle.com/javase/tutorial/java/javaOO/lambdaexpressions.html>.

The easiness with which one can employ lambdas functions in Java relates directly to the Java compiler doing a lot of helpful stuff behind the curtain, supporting lambda related syntax sugar and doing extensive (and great!) type inferences. Therefore many chained lambdas functions in Java look so simple and clean. Behind the curtain the Java compiler will create the necessary classes to satisfy Java. The Java compiler people have been doing really a very, very nice job at that, but ...

... there are some (maybe not so obvious) catches here:

  • there are more and more complex lambda chains that are unintelligible upfront, if you were not the original author or have not worked with these chains for a longer time; in this case the APL-phenonemon may pop up: one can solve the most complex problems very elegantly with quite a few lines of code, sometimes for the price that you do not understand your own code after a while, :)

  • following the discussions in some of the OpenJDK lists (where Java evolves from version to version and where the super experts discuss) quite often lambdas are presented to make a point, but if they are complex, then it may be the case that
    ​​
    you will find additional informal documentations of what these Lambdas actually do and what Lambda functions really get deployed and why.

Of course you are right, any Rexx version has to be "designed for people, not computers"!

​​
The challenge with lambdas is to come with a syntax that is self-describing and allows for clearly finding the functional Java interface class that is being employed,
​​
such that any inferral from NetRexx is straight-forward and the resulting code again legible at all times.

As you have been digging deeper and deeper into these interesting Java areas, maybe you could come up with some ideas or designs that would make it easy for NetRexx programmers to employ Java lambdas in the future?  Any idea or suggestion would be highly welcome, I am sure!

---rony



On 13.01.2018 15:18, [hidden email] wrote:
Dear Mr. Woodman,
Once again thank you for your answer.
Your example is very clear and it works.

Now:  to the creators and maintainers of NetRexx.
I have a couple of questions/requests, that have been triggered by this Lambda experience.
Yes, Lambda expressions can be emulated in NetRexx with 'minor and dependent classes'.  But is this desirable?

From the NetRexx documentation:  "NetRexx is designed for people, not computers."
If this is true, Lambda expressions should be implemented in NetRexx, like other NetRexx functions: in an easy way.
If you look at the code needed in order to implement Lambda, that is "not" easy.  At least as far (as newbie) as I can see.

There are also two operations (that come into my mind) that are not implemented in NetRexx, but they should:
1-  increment operators ++  (i++)   They exist in C++ and in Java.  
2-  bitwise operators.  I can invert bits with an XOR, and I can shift bits with multiplication/division by 2**n.  Nevertheless a specific operator should be easier.

NetRexx, a great REXX dialect (it still is!), was born more than 20 years ago.  But times have changed, so has the JVM and its users.
NetRexx was great as an scripting language, but can be, and probably is, used in more serious projects nowadays.
Please do consider these points (and probably others) when perhaps planning a NetRexx 4.0 release.

We still do want a language designed for people, not machines, and NetRexx is for this, just great!  
(where is Mr. Cowlishaw, the REXX company hero of 30 years ago, when he is needed?  :-)

Sincerely,
Gus





"Dave Woodman" [hidden email]
Sent by: [hidden email]

2018-01-13 01:19

Please respond to
IBM Netrexx [hidden email]

To
"'IBM Netrexx'" [hidden email],
cc

Subject
Re: [Ibm-netrexx] Java Lambdas and NetRexx







Hi Gus,
 
In NetRexx we cannot do an in-line subclass – instead we have to specify what is referred to as a “dependent class” as a separate class definition.
 
So, something along the lines of
 
class NetRexx_WithoutLambda public
                method NetRexx_WithoutLambda
                                runme().run
                               
              method main($cmdin1=String[]) static;arg=Rexx($cmdin1)
                             me = NetRexx_WithoutLambda()
     
class NetRexx_WithoutLambda.runme dependent implements Runnable
                method run
                                say "and NetRexx works without Lambdas..."
                                                                                                                                                             
might be what you are looking for.
 
         Dave.                    



_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: Lambdas... | future... | gorilla's

ThSITC
In reply to this post by gustavo_mindreau

Hi Gus!

I am interested whether You do have a good Idea how to implement Lambdas in NetRexx !

I am just in a phase to collect new ideas for NetRexx 4.00 (most probably 5.00 :-(   ) ....

I am, however, not so fluent in Java senses as You are ...

Maybe I am a GORILLA ;-)

Kindly, Thomas Schneider, Vienna, Austria :-)

=====================================================================


Am 13.01.2018 um 18:37 schrieb [hidden email]:
Well, there are users and users.  A colleague of me commented yesterday, "but why would you need to use Lambdas...".
I do not.  I am just an old fashioned programmer, a Structured Programming aficionado (and OOP hater), wanting to make WORA programs for the JVM.
When you learn a 'little' of Java it is rather easy to make simple NetRexx programs run with the extensive JAVA API.  So far so good.
But then you find JavaFX and want to expand your horizons from cmd line output to GUI.

Unfortunately the documentation in question (JavaFX) starts talking about Lambdas and their use with OnAction handlers.
Then you are stuck.  One solution is to find a way to interpret what those particular Lambdas are doing and then replace them with some clever, more simple and easier NetRexx code.
The other solution / alternative is: learn more JAVA !   And this implies learning OOP.  
And OOP, as I read, got all this implicit environment that they carry around with them. You wanted a banana but what you got was a gorilla holding the banana and the entire jungle.

No thank you.  I prefer Structured Programming; it is simple, elegant and "effective".
Besides, if you ever become efficient in Java to understand all those complicated constructions, and Lambdas, then why bother using NetRexx.  Stay then in Java as an specialist.
But that is not the original point, isn't it?  We want NetRexx, a language easy for "people"  (not only for dummies trying to find an uncomplicated User's Guide).
Anyway, thank you very much for sharing your insight with us.  Perhaps I should go back to Classic Rexx and only program for z/VM CMS :-(

Sincerely,
Gus





"Rony G. Flatscher" [hidden email]
Sent by: [hidden email]

2018-01-13 15:36

Please respond to
IBM Netrexx [hidden email]

To
IBM Netrexx [hidden email],
cc

Subject
Re: [Ibm-netrexx] Lambdas & NetRexx - future...







Hi Gus,

just a little remark ad lambdas and Java: as you probably know lambdas are implemented as normal Java classes that need to implement normal Java interface classes from the Java function package (<https://docs.oracle.com/javase/8/docs/api/java/util/function/package-summary.html>), e.g. cf. <https://docs.oracle.com/javase/tutorial/java/javaOO/lambdaexpressions.html>.

The easiness with which one can employ lambdas functions in Java relates directly to the Java compiler doing a lot of helpful stuff behind the curtain, supporting lambda related syntax sugar and doing extensive (and great!) type inferences. Therefore many chained lambdas functions in Java look so simple and clean. Behind the curtain the Java compiler will create the necessary classes to satisfy Java. The Java compiler people have been doing really a very, very nice job at that, but ...

... there are some (maybe not so obvious) catches here:

  • there are more and more complex lambda chains that are unintelligible upfront, if you were not the original author or have not worked with these chains for a longer time; in this case the APL-phenonemon may pop up: one can solve the most complex problems very elegantly with quite a few lines of code, sometimes for the price that you do not understand your own code after a while, :)
  • following the discussions in some of the OpenJDK lists (where Java evolves from version to version and where the super experts discuss) quite often lambdas are presented to make a point, but if they are complex, then it may be the case that you will find additional informal documentations of what these Lambdas actually do and what Lambda functions really get deployed and why.
Of course you are right, any Rexx version has to be "designed for people, not computers"! The challenge with lambdas is to come with a syntax that is self-describing and allows for clearly finding the functional Java interface class that is being employed, such that any inferral from NetRexx is straight-forward and the resulting code again legible at all times.

As you have been digging deeper and deeper into these interesting Java areas, maybe you could come up with some ideas or designs that would make it easy for NetRexx programmers to employ Java lambdas in the future?  Any idea or suggestion would be highly welcome, I am sure!

---rony


_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/



Virus-free. www.avg.com

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Thomas Schneider, Vienna, Austria (Europe) :-)

www.thsitc.com
www.db-123.com