Java 8 and Lambdas

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

Java 8 and Lambdas

Kermit Kiser
As you know, Oracle has just released Java 8. I have been examining it
with concern since NetRexx needs to fully support all significant Java
facilities to remain relevant. If NetRexx cannot remain compatible with
Java, it will quickly become useless to me and perhaps to others also.

Some Java 8 changes may impact NetRexx syntax, for example default and
static interface methods. However the main focus of Java 8 seems to be
the concept of "lambdas". The more I research this new "feature", the
more I suspect that it offers NO NEW FUNCTIONALITY for Java. In fact
lambdas appear to be an attempt to simplify the cumbersome syntax chosen
by the original language developers. In other words, Java seems to be
moving in the direction of the NetRexx philosophy of making programming
easier for developers rather than computers!

Since I don't have the language theory background of some list members,
can anyone please verify that lambdas are not a significant problem for
NetRexx development or correct me if my interpretation is wrong?

Likewise does anyone know if there are other new Java 8 features that
need to be considered by the NetRexx translator developers?

Thanks for your time,

-- Kermit

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

Reply | Threaded
Open this post in threaded view
|

Re: Java 8 and Lambdas

Dave Woodman
Hi Kermit,

This prompted me to poke about anew, and, when reading
http://cr.openjdk.java.net/~briangoetz/lambda/lambda-libraries-final.html, I
found a couple of things of interest:-

        Internal iteration within collections (effectively "loop over"
inside the collection)
        Steams (java.util.stream) - a convenient way to process a subset of
a list or set. This would appear to be new functionality

Reading the document would seem to indicate that there is a need to pass a
lambda expression into a method as a parameter to a method call.

Cheers,

        Dave.


-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of Kermit Kiser
Sent: 23 March 2014 04:37
To: IBM Netrexx
Subject: [Ibm-netrexx] Java 8 and Lambdas

As you know, Oracle has just released Java 8. I have been examining it with
concern since NetRexx needs to fully support all significant Java facilities
to remain relevant. If NetRexx cannot remain compatible with Java, it will
quickly become useless to me and perhaps to others also.

Some Java 8 changes may impact NetRexx syntax, for example default and
static interface methods. However the main focus of Java 8 seems to be the
concept of "lambdas". The more I research this new "feature", the more I
suspect that it offers NO NEW FUNCTIONALITY for Java. In fact lambdas appear
to be an attempt to simplify the cumbersome syntax chosen by the original
language developers. In other words, Java seems to be moving in the
direction of the NetRexx philosophy of making programming easier for
developers rather than computers!

Since I don't have the language theory background of some list members, can
anyone please verify that lambdas are not a significant problem for NetRexx
development or correct me if my interpretation is wrong?

Likewise does anyone know if there are other new Java 8 features that need
to be considered by the NetRexx translator developers?

Thanks for your time,

-- Kermit

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


---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com

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

Reply | Threaded
Open this post in threaded view
|

Re: Java 8 and Lambdas

Tom Maynard
In reply to this post by Kermit Kiser

On 22-Mar-14 23:36, Kermit Kiser wrote:
> Java 8...offers NO NEW FUNCTIONALITY for Java. In fact lambdas appear
> to be an attempt to simplify the cumbersome syntax
While I doubt that it persists to this day, I put in a (very mild)
"request" for Lambdas in NetRexx, back when ticket numbers were only
just out of the single digits.

My position what that other alternative JVM languages already had
lambdas (Groovy, e.g.), and that even though Oracle was "hinting" about
having lambdas in Java 8, there wasn't any particular need to wait for
it.  However, it had (and still should have) the lowest of all possible
priorities.

If NetRexx had them, I would use them ... that's all.

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

Reply | Threaded
Open this post in threaded view
|

Re: Java 8 and Lambdas

Fernando Cassia-2
In reply to this post by Kermit Kiser

On Sun, Mar 23, 2014 at 1:36 AM, Kermit Kiser <[hidden email]> wrote:
Since I don't have the language theory background of some list members, can anyone please verify that lambdas are not a significant problem for NetRexx development or correct me if my interpretation is wrong?

First of all, whatever language syntax additions are introduced in Java, I don´t see how those could affect third party JVM langs. After all, it´s not that they´ve made lambdas mandatory... it´s just a new way to code certain constructs saving time and typing for those who code in Java. But we don´t.

In other words, IMHO, you´re comparing Java language syntax with the ability of the JRE to run arbitrary java bytecode.

Since NetRexx compiles to Java bytecode... and as long as the bytecode generated by the netrexxc is of a recent enough version (there´s been discussion of removing support for Java 1.4 and earlier in next JDK updates) then, the JRE should have no trouble running any bytecode you throw at it.

Now, if you are actually asking ¨couldn´t NetRexxC translate certain NetRexxconstructs to lambdas so that we use that Java8 feature and improve performance or whatever" then that is indeed a very good question!, that imho MFC is the most qualified to answer :)

...But then it´s 2:50am and I really need to sleep, so there´s a high probability that I must be missing something obvious from my reasoning...

FC
--
During times of Universal Deceit, telling the truth becomes a revolutionary act
Durante épocas de Engaño Universal, decir la verdad se convierte en un Acto Revolucionario
- George Orwell

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

Reply | Threaded
Open this post in threaded view
|

Re: Java 8 and Lambdas

Tom Maynard
In reply to this post by Kermit Kiser

On 23-Mar-14 23:58, Tom Maynard wrote:

While I doubt that it persists to this day, I put in a (very mild) "request" for Lambdas in NetRexx, back when ticket numbers were only just out of the single digits.

Rather surprisingly, Ticket #NETREXX-22 can still be found within the system … along with some additional commentary from Patric, René, and Rony. At the time there were much bigger fish to fry, and as long as any “real” problem exists it should always take precedence over a “make work” idea.

Then, as now, lambdas are far from a necessity … rather they fall into the category of “right tool, for the right job, at the right time”, and those planets don’t align frequently enough for grizzled old imperative programmers to feel a requirement for them. The fact that Oracle has finally delivered on its promise to include them in Java, when the list of things postponed from this release may shake a few heads, pretty much states my case for me.

Put ‘em in when the time is right. I only know a couple of programmers who specifically chose Groovy or Scala as their development language because it included lambdas, but most programmers with some functional coding exposure in their past will see the feature as a desirable one.


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

Reply | Threaded
Open this post in threaded view
|

Re: Java 8 and Lambdas

ThSITC
In reply to this post by Kermit Kiser
Hello Kermit, and all,

as You all do know from so many past mails, I am a foolish inventor,
proposing too many things to be done.

*************************
May I suggest that www.netrexx.org does found a group which does write a
*Spec* of any and all Java 8 features
to be implemented in Netrexx, and/or it's successor(s).

My personal feeling is that when we can not manage it to become UpToDate
with current Java Technolonogies
within the Rexx Family of Languages, then we might invest too much time
in dying kids, however *good the kids
have been designed, created, maintained, and supported*

Any Kid has to become adult (or what?).

Thomas.
====================================================================================
Am 23.03.2014 05:36, schrieb Kermit Kiser:

> As you know, Oracle has just released Java 8. I have been examining it
> with concern since NetRexx needs to fully support all significant Java
> facilities to remain relevant. If NetRexx cannot remain compatible
> with Java, it will quickly become useless to me and perhaps to others
> also.
>
> Some Java 8 changes may impact NetRexx syntax, for example default and
> static interface methods. However the main focus of Java 8 seems to be
> the concept of "lambdas". The more I research this new "feature", the
> more I suspect that it offers NO NEW FUNCTIONALITY for Java. In fact
> lambdas appear to be an attempt to simplify the cumbersome syntax
> chosen by the original language developers. In other words, Java seems
> to be moving in the direction of the NetRexx philosophy of making
> programming easier for developers rather than computers!
>
> Since I don't have the language theory background of some list
> members, can anyone please verify that lambdas are not a significant
> problem for NetRexx development or correct me if my interpretation is
> wrong?
>
> Likewise does anyone know if there are other new Java 8 features that
> need to be considered by the NetRexx translator developers?
>
> Thanks for your time,
>
> -- Kermit
>
> _______________________________________________
> Ibm-netrexx mailing list
> [hidden email]
> Online Archive : http://ibm-netrexx.215625.n3.nabble.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
Reply | Threaded
Open this post in threaded view
|

Re: Java 8 and Lambdas

ThSITC
In reply to this post by Dave Woodman
Did anyone of us (TheRexxFamilyOfLanguages) ever get into direct contact
with Oracle/Sun/Java Groups
to convince them to use their *Lambdas* ti move the ancient and
cumbersome Java Syntax
to more *elegant* and *intelligent* designs like *Netrexx Language ones* ???

Might be an interesting project, to stay *downwards compatible*, and
*make a better language*

We here, in the *Rexx Family of Languages*, do have the same problem, I
think:

DIVERGING ideas, implementations, dialects, standards.

We do have (at least at RexxLA) a FAMILY of Languages, but not *The
Language* :-(

Doesn't matter, really, as we then do have always have to learn
something new :-)

thomas.
================================================================
Am 23.03.2014 10:22, schrieb Dave Woodman:

> Hi Kermit,
>
> This prompted me to poke about anew, and, when reading
> http://cr.openjdk.java.net/~briangoetz/lambda/lambda-libraries-final.html, I
> found a couple of things of interest:-
>
> Internal iteration within collections (effectively "loop over"
> inside the collection)
> Steams (java.util.stream) - a convenient way to process a subset of
> a list or set. This would appear to be new functionality
>
> Reading the document would seem to indicate that there is a need to pass a
> lambda expression into a method as a parameter to a method call.
>
> Cheers,
>
> Dave.
>
>
> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]] On Behalf Of Kermit Kiser
> Sent: 23 March 2014 04:37
> To: IBM Netrexx
> Subject: [Ibm-netrexx] Java 8 and Lambdas
>
> As you know, Oracle has just released Java 8. I have been examining it with
> concern since NetRexx needs to fully support all significant Java facilities
> to remain relevant. If NetRexx cannot remain compatible with Java, it will
> quickly become useless to me and perhaps to others also.
>
> Some Java 8 changes may impact NetRexx syntax, for example default and
> static interface methods. However the main focus of Java 8 seems to be the
> concept of "lambdas". The more I research this new "feature", the more I
> suspect that it offers NO NEW FUNCTIONALITY for Java. In fact lambdas appear
> to be an attempt to simplify the cumbersome syntax chosen by the original
> language developers. In other words, Java seems to be moving in the
> direction of the NetRexx philosophy of making programming easier for
> developers rather than computers!
>
> Since I don't have the language theory background of some list members, can
> anyone please verify that lambdas are not a significant problem for NetRexx
> development or correct me if my interpretation is wrong?
>
> Likewise does anyone know if there are other new Java 8 features that need
> to be considered by the NetRexx translator developers?
>
> Thanks for your time,
>
> -- Kermit
>
> _______________________________________________
> Ibm-netrexx mailing list
> [hidden email]
> Online Archive : http://ibm-netrexx.215625.n3.nabble.com/
>
>
> ---
> This email is free from viruses and malware because avast! Antivirus protection is active.
> http://www.avast.com
>
> _______________________________________________
> Ibm-netrexx mailing list
> [hidden email]
> Online Archive : http://ibm-netrexx.215625.n3.nabble.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
Reply | Threaded
Open this post in threaded view
|

Re: Java 8 and Lambdas

Fernando Cassia-2
In reply to this post by Tom Maynard

On Mon, Mar 24, 2014 at 2:58 AM, Tom Maynard <[hidden email]> wrote:
The fact that Oracle has finally delivered on its promise to include them in Java, when the list of things postponed from this release may shake a few heads, pretty much states my case for me.

Well, they delivered a new Javascript engine (Nashorn), compact profiles... and tons of goodies.

http://openjdk.java.net/projects/jdk8/features

FC
--
During times of Universal Deceit, telling the truth becomes a revolutionary act
Durante épocas de Engaño Universal, decir la verdad se convierte en un Acto Revolucionario
- George Orwell

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

Reply | Threaded
Open this post in threaded view
|

Re: Java 8 and Lambdas

Tom Maynard

On 24-Mar-14 15:47, Fernando Cassia wrote:
> Well, they delivered a new Javascript engine (Nashorn), compact
> profiles... and tons of goodies.
You're preaching to the choir here, Fernando: I've been running Java 8
since it first became available (starting as a beta).

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

Reply | Threaded
Open this post in threaded view
|

Re: Java 8 and Lambdas

rvjansen
Yes, built it myself every few days until GA was reached last week or so, to make sure that NetRexx is fine.

For lambda's, I still would like a proposal that can be implemented for ooRexx as well.

best regards,

René.

On 24 mrt. 2014, at 22:33, Tom Maynard <[hidden email]> wrote:

>
> On 24-Mar-14 15:47, Fernando Cassia wrote:
>> Well, they delivered a new Javascript engine (Nashorn), compact profiles... and tons of goodies.
> You're preaching to the choir here, Fernando: I've been running Java 8 since it first became available (starting as a beta).
>
> _______________________________________________
> Ibm-netrexx mailing list
> [hidden email]
> Online Archive : http://ibm-netrexx.215625.n3.nabble.com/
>

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

Reply | Threaded
Open this post in threaded view
|

Re: Java 8 and Lambdas

Tom Maynard

On 25-Mar-14 11:34, René Jansen wrote:
> Yes, built it myself every few days until GA was reached
That's rather more of a commitment than I made, René.  I just wanted to
experiment with all the new goodies :-)

> For lambda's, I still would like a proposal that can be implemented for ooRexx as well.
Ah, yes: That's where it stood when I stopped paying attention. What
would a suitable proposal be, actually?  Syntax (BNF), railroad diagram,
verbose description, or what?

Note that I'm only exploring my capability to provide one, certainly not
promising to attempt it.  (But how hard could it be?! -- famous last
words, right along with "What could go wrong?")

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

Reply | Threaded
Open this post in threaded view
|

Re: Java 8 and Lambdas

Tom Maynard
In reply to this post by Kermit Kiser

Purely by coincidence the current “DZone Weekly” newsletter has a feature article about 5 Features in Java 8 That Will Change How You Code. The #1 feature is lambda expressions, which are mentioned again in #2. The article is actually quoting the Takipi blog.

In fact, not every alternative JVM language is bothering with (or worrying about) Java 8 adaptation. For example, from the Clojure mailing list:


Andy Fingerhut

There are only two changes I am aware of for JDK8 preparation so far, and they are simply to allow Clojure to compile without warnings [1] and pass all of the unit tests without failure when using JDK8 [2]. These are minor changes.

[1] http://dev.clojure.org/jira/browse/CLJ-1264
[2] http://dev.clojure.org/jira/browse/CLJ-1246

[2] was really an existing issue before JDK8 — it is simply that a change in the annotations of the Java class library caused the problem to be exposed with the existing unit tests when run on JDK 8.

Andy


In an interview with Martin Odersky, creator of Scala, he says any (small) changes will be simply to tweak the bytecode emitted by the compiler to meld better with the new JVM. Since NetRexx translates to Java source, and javac does the heavy lifting on the bytecode end, it’s conceivable that no changes will be required at all.

The decision to modify the NetRexx translator to emit Java 8 idiomatic code is completely optional, as far as I can tell. If NetRexx is at risk of obsolescence in some area, I’m sure we’d all like to know.


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

Reply | Threaded
Open this post in threaded view
|

Re: Java 8 and Lambdas

George Hovey-2
Re "Since NetRexx translates to Java source, and javac does the heavy lifting on the bytecode end"

I take this to be further confirmation of the wisdom of that approach.


On Wed, Mar 26, 2014 at 5:21 PM, Tom Maynard <[hidden email]> wrote:

Purely by coincidence the current “DZone Weekly” newsletter has a feature article about 5 Features in Java 8 That Will Change How You Code. The #1 feature is lambda expressions, which are mentioned again in #2. The article is actually quoting the Takipi blog.

In fact, not every alternative JVM language is bothering with (or worrying about) Java 8 adaptation. For example, from the Clojure mailing list:


Andy Fingerhut

There are only two changes I am aware of for JDK8 preparation so far, and they are simply to allow Clojure to compile without warnings [1] and pass all of the unit tests without failure when using JDK8 [2]. These are minor changes.

[1] http://dev.clojure.org/jira/browse/CLJ-1264
[2] http://dev.clojure.org/jira/browse/CLJ-1246

[2] was really an existing issue before JDK8 — it is simply that a change in the annotations of the Java class library caused the problem to be exposed with the existing unit tests when run on JDK 8.

Andy


In an interview with Martin Odersky, creator of Scala, he says any (small) changes will be simply to tweak the bytecode emitted by the compiler to meld better with the new JVM. Since NetRexx translates to Java source, and javac does the heavy lifting on the bytecode end, it’s conceivable that no changes will be required at all.

The decision to modify the NetRexx translator to emit Java 8 idiomatic code is completely optional, as far as I can tell. If NetRexx is at risk of obsolescence in some area, I’m sure we’d all like to know.


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





--
"One can live magnificently in this world if one knows how to work and how to love."  --  Leo Tolstoy

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

Reply | Threaded
Open this post in threaded view
|

Re: Java 8 and Lambdas

Ramesh Gopal
The decision to modify the NetRexx translator to emit Java 8 idiomatic code *may not* be completely optional. My reading of the latest Java 8 changes seem to indicate that the Java developers have embedded lambdas deep into the standard libraries.

What this seems to suggest to me is that if NetRexx is going to target running on JVM 8, then the emitted code will likely need to make calls to the standard libraries using the new lambda conventions.

However, my reading of the changes does not seem to suggest one way or another whether the standard libraries will support dual interfaces, i.e. the old way of invocation without lambdas (for JDK 7 and earlier) , and the new way with lambdas (for JDK 8 and later).
Reply | Threaded
Open this post in threaded view
|

Re: Java 8 and Lambdas

rvjansen
Hi Ramesh,

thanks for thinking of this. Do you have a specific example?

As George stated earlier, by splitting up the generation of Java source and then using a compiler (and we can use several) we are always at the current bytecode level as long as the compiler backed generates it.
I am not sure that the library people will want to invalidate KLOCS of Java code by changing the calling convention; and by that argument all NetRexx code will also be safe.

As for the "going to target running on JVM 8", we are for a long time already testing on weekly builds, and have no test cases failing on Java 8, not even the interpreted code.

It would be great if you could supply an example of what you think might go wrong, so we can focus on starting fixing it.

Apart from that, I am not at all opposed to enable this nifty notation in NetRexx.

best regards,

René Jansen.


On 27 mrt. 2014, at 04:35, Ramesh Gopal <[hidden email]> wrote:

> The decision to modify the NetRexx translator to emit Java 8 idiomatic code
> *may not* be completely optional. My reading of the latest Java 8 changes
> seem to indicate that the Java developers have embedded lambdas deep into
> the standard libraries.
>
> What this seems to suggest to me is that if NetRexx is going to target
> running on JVM 8, then the emitted code will likely need to make calls to
> the standard libraries using the new lambda conventions.
>
> However, my reading of the changes does not seem to suggest one way or
> another whether the standard libraries will support dual interfaces, i.e.
> the old way of invocation without lambdas (for JDK 7 and earlier) , and the
> new way with lambdas (for JDK 8 and later).
>
>
>
>
> --
> View this message in context: http://ibm-netrexx.215625.n3.nabble.com/Java-8-and-Lambdas-tp4026954p4026970.html
> Sent from the ibm-netrexx mailing list archive at Nabble.com.
>
> _______________________________________________
> Ibm-netrexx mailing list
> [hidden email]
> Online Archive : http://ibm-netrexx.215625.n3.nabble.com/
>

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

Reply | Threaded
Open this post in threaded view
|

Re: Java 8 and Lambdas

Ramesh Gopal
Hi Rene,

My thinking on this was shaped by 2 articles written by Brian Goetz, the Java Chief Language Architect:


and


It would appear that backwards compatibility in the libraries are preserved, as you correctly point out that existing NetRexx code already works on JVM 8. Brian Goetz also makes this point by noting "... we pursue an evolutionary strategy of adding extension methods to existing interfaces ...".

It is apparent from the above, however, that to exploit the new Collections and Streams features, NetRexx will need to support lambdas and possibly, generics.

I do not by any stretch of the imagination intend to dictate how NetRexx should evolve, but my thinking revolves around what is the raison d'etre of NetRexx.

If one concludes that:

a) NetRexx's main goal is to make Java programming easier, and bring some great high-level facilities from Rexx (such as PARSE, TRACE, arbitrary precision arithmetic, etc) into the Java world; and

b) NetRexx will continue to emit Java code instead of directly compiling to bytecode; then

the language certainly needs to adapt to the recent changes in Java. This makes NetRexx continue to be relevant for those of us who don't like Java's ceremonial syntax and for those of us who want to leverage some great Rexx facilities.

IMHO, we may need to look at adding generics, annotations and lambdas, so that converting Java code to NetRexx can be easily done. Otherwise, we may need to still write stuff in Java when NetRexx can't (easily) do the job, and then call that Java code from NetRexx. This necessitates a developer having to know both Java and NetRexx sufficiently well in order to do this.

Another thing to consider is NetRexx's "competition".

I have recently learnt that some Java developers have also been thinking about getting rid of Java's ceremonial syntax, and they succeeded by creating Xtend (https://www.eclipse.org/xtend/). Like NetRexx, Xtend gets rid of Java ceremony, and it also translates Xtend code into Java code.

Hope my ramblings help and make sense!



On Thu, Mar 27, 2014 at 6:46 PM, René Jansen <[hidden email]> wrote:
Hi Ramesh,

thanks for thinking of this. Do you have a specific example?

As George stated earlier, by splitting up the generation of Java source and then using a compiler (and we can use several) we are always at the current bytecode level as long as the compiler backed generates it.
I am not sure that the library people will want to invalidate KLOCS of Java code by changing the calling convention; and by that argument all NetRexx code will also be safe.

As for the "going to target running on JVM 8", we are for a long time already testing on weekly builds, and have no test cases failing on Java 8, not even the interpreted code.

It would be great if you could supply an example of what you think might go wrong, so we can focus on starting fixing it.

Apart from that, I am not at all opposed to enable this nifty notation in NetRexx.

best regards,

René Jansen.


On 27 mrt. 2014, at 04:35, Ramesh Gopal <[hidden email]> wrote:

> The decision to modify the NetRexx translator to emit Java 8 idiomatic code
> *may not* be completely optional. My reading of the latest Java 8 changes
> seem to indicate that the Java developers have embedded lambdas deep into
> the standard libraries.
>
> What this seems to suggest to me is that if NetRexx is going to target
> running on JVM 8, then the emitted code will likely need to make calls to
> the standard libraries using the new lambda conventions.
>
> However, my reading of the changes does not seem to suggest one way or
> another whether the standard libraries will support dual interfaces, i.e.
> the old way of invocation without lambdas (for JDK 7 and earlier) , and the
> new way with lambdas (for JDK 8 and later).
>
>
>
>
> --
> View this message in context: http://ibm-netrexx.215625.n3.nabble.com/Java-8-and-Lambdas-tp4026954p4026970.html
> Sent from the ibm-netrexx mailing list archive at Nabble.com.
>
> _______________________________________________
> Ibm-netrexx mailing list
> [hidden email]
> Online Archive : http://ibm-netrexx.215625.n3.nabble.com/
>

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



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

Reply | Threaded
Open this post in threaded view
|

Re: Java 8 and Lambdas

rvjansen
Hi Ramesh,

your contribution to the discussion is highly appreciated; thank you for the two links, they made for a better understanding of the current state of lambda.

There are indeed separate points to address. A NetRexx notation for "closures" and the point of the lambdafication of class library calls.

The first needs good design and a group decision that is in the tradition of Rexx. If we look at this as a modification of what was started with anonymous inner classes, it must become clear that the 'dependent' class construction that NetRexx uses does not really lend itself to adaptation in this direction (at least, my subjective impression here). The point of these was mostly that operations of GUI classes could be inlined (no great coincidence they popped up during Swing development) but the NetRexx variant placed these firmly out of the way into their own class files, or at least outside of the handling class.

When we see lambda's as a refinement in which even the Java language architects decided there was too much 'ceremony' then we ought to reflect on what would be the Rexx way to accomplish this, and how it would look so we will like it and use it.

I think you are right in the assessment that we must allow for the notation that enables the new, internal iteration primitives of the collection class. This is probably a lesser modification of the parser (as the damage only occurrs within the parentheses of the method call) but still someone must find the time to analyze & implement.

best regards,

René Jansen.


On 27 mrt. 2014, at 14:15, Ramesh Gopal <[hidden email]> wrote:

Hi Rene,

My thinking on this was shaped by 2 articles written by Brian Goetz, the Java Chief Language Architect:


and


It would appear that backwards compatibility in the libraries are preserved, as you correctly point out that existing NetRexx code already works on JVM 8. Brian Goetz also makes this point by noting "... we pursue an evolutionary strategy of adding extension methods to existing interfaces ...".

It is apparent from the above, however, that to exploit the new Collections and Streams features, NetRexx will need to support lambdas and possibly, generics.

I do not by any stretch of the imagination intend to dictate how NetRexx should evolve, but my thinking revolves around what is the raison d'etre of NetRexx.

If one concludes that:

a) NetRexx's main goal is to make Java programming easier, and bring some great high-level facilities from Rexx (such as PARSE, TRACE, arbitrary precision arithmetic, etc) into the Java world; and

b) NetRexx will continue to emit Java code instead of directly compiling to bytecode; then

the language certainly needs to adapt to the recent changes in Java. This makes NetRexx continue to be relevant for those of us who don't like Java's ceremonial syntax and for those of us who want to leverage some great Rexx facilities.

IMHO, we may need to look at adding generics, annotations and lambdas, so that converting Java code to NetRexx can be easily done. Otherwise, we may need to still write stuff in Java when NetRexx can't (easily) do the job, and then call that Java code from NetRexx. This necessitates a developer having to know both Java and NetRexx sufficiently well in order to do this.

Another thing to consider is NetRexx's "competition".

I have recently learnt that some Java developers have also been thinking about getting rid of Java's ceremonial syntax, and they succeeded by creating Xtend (https://www.eclipse.org/xtend/). Like NetRexx, Xtend gets rid of Java ceremony, and it also translates Xtend code into Java code.

Hope my ramblings help and make sense!



On Thu, Mar 27, 2014 at 6:46 PM, René Jansen <[hidden email]> wrote:
Hi Ramesh,

thanks for thinking of this. Do you have a specific example?

As George stated earlier, by splitting up the generation of Java source and then using a compiler (and we can use several) we are always at the current bytecode level as long as the compiler backed generates it.
I am not sure that the library people will want to invalidate KLOCS of Java code by changing the calling convention; and by that argument all NetRexx code will also be safe.

As for the "going to target running on JVM 8", we are for a long time already testing on weekly builds, and have no test cases failing on Java 8, not even the interpreted code.

It would be great if you could supply an example of what you think might go wrong, so we can focus on starting fixing it.

Apart from that, I am not at all opposed to enable this nifty notation in NetRexx.

best regards,

René Jansen.


On 27 mrt. 2014, at 04:35, Ramesh Gopal <[hidden email]> wrote:

> The decision to modify the NetRexx translator to emit Java 8 idiomatic code
> *may not* be completely optional. My reading of the latest Java 8 changes
> seem to indicate that the Java developers have embedded lambdas deep into
> the standard libraries.
>
> What this seems to suggest to me is that if NetRexx is going to target
> running on JVM 8, then the emitted code will likely need to make calls to
> the standard libraries using the new lambda conventions.
>
> However, my reading of the changes does not seem to suggest one way or
> another whether the standard libraries will support dual interfaces, i.e.
> the old way of invocation without lambdas (for JDK 7 and earlier) , and the
> new way with lambdas (for JDK 8 and later).
>
>
>
>
> --
> View this message in context: http://ibm-netrexx.215625.n3.nabble.com/Java-8-and-Lambdas-tp4026954p4026970.html
> Sent from the ibm-netrexx mailing list archive at Nabble.com.
>
> _______________________________________________
> Ibm-netrexx mailing list
> [hidden email]
> Online Archive : http://ibm-netrexx.215625.n3.nabble.com/
>

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


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



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

Reply | Threaded
Open this post in threaded view
|

Re: Java 8 and Lambdas

Kermit Kiser
In reply to this post by rvjansen
René -

OK, you got me! I have been too busy finalizing NetRexx plugin 1.0.0 for
jEdit and submitting it to Plugin Central to try Java 8 until now. It
took me a while to figure out that 3.02GA does not work with Java 8 -
you have to use the 3.03 dev build with the patch for issue #106!

There may be other people who run into this now that Java 8 is GA and
people are starting to convert. Since we have a 3.02 branch for the
purpose of adding fixes, I suggest that we apply your 106 patch to that
branch and issue a revised 3.02 release. There are significant changes
needed for 3.03 and I doubt they will happen quickly! We should also
consider publishing a compatibility document on the web site to explain
what Java features are supported or not by which NetRexx versions.

What do you think?

-- Kermit

On 3/25/2014 9:34 AM, René Jansen wrote:

> Yes, built it myself every few days until GA was reached last week or so, to make sure that NetRexx is fine.
>
> For lambda's, I still would like a proposal that can be implemented for ooRexx as well.
>
> best regards,
>
> René.
>
> On 24 mrt. 2014, at 22:33, Tom Maynard <[hidden email]> wrote:
>
>> On 24-Mar-14 15:47, Fernando Cassia wrote:
>>> Well, they delivered a new Javascript engine (Nashorn), compact profiles... and tons of goodies.
>> You're preaching to the choir here, Fernando: I've been running Java 8 since it first became available (starting as a beta).
>>
>> _______________________________________________
>> Ibm-netrexx mailing list
>> [hidden email]
>> Online Archive : http://ibm-netrexx.215625.n3.nabble.com/
>>
> _______________________________________________
> Ibm-netrexx mailing list
> [hidden email]
> Online Archive : http://ibm-netrexx.215625.n3.nabble.com/
>
>
>

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

Reply | Threaded
Open this post in threaded view
|

Re: Java 8 and Lambdas

Kermit Kiser
In reply to this post by rvjansen
Finally got some time to look at Java 8 and run a few experiments. The results kind of surprised me and at the same time did not surprise me. By which I mean that I was sure that NetRexx could use most of the new Java 8 facilities without problems and without need of lambdas and that is quite true. But I also expected that NetRexx would not recognize default methods in interfaces and that would cause it to explode. It did not! NetRexx (the weekly 303 build from the netrexx.org web site) works surprisingly well with Java 8.

The following is a short test module that I wrote to exercise Java 8 streams, filters and foreach using hard coded Predicate and Consumer classes. It is possible that some type of lambda syntax would be easier to code with but the current situation is no different than what we have been dealing with for a long time without anonymous class definitions or other nested class syntax. You can see that NetRexx already works fine with the new Java 8 features.
----------------------------------------------------------------------------------------------------------------------------

-- make a string of words with a couple containing the letter 'k'

wordstring=String "Just a bunch of words to test for killer items containing a k"

-- convert the string into a Java List (a Collection):

alist=ArrayList(Arrays.asList(wordstring.split(" ")))

-- now run a filter stream operation on the list
-- using a hard coded Predicate class for a filter instead of a Java lambda expression:
-- (the filter just selects words containing the letter 'k')

sa=alist.stream.filter(Pred()).toArray

-- print the results for verification:

loop y over sa
    say y
    end

say "-----------------------"

    -- now run a foreach operation on a stream
    -- using a hard coded Consumer class instead of a Java lambda
--     the consumer here just prints inputs with some surrounding brackets

alist.stream.foreach(Eatem())

class Pred implements Predicate
    method test(s=Object) returns boolean
        return Rexx(s.toString).pos('k')>0
       
class Eatem implements Consumer
    method accept(s=Object)
        say ">>"s"<<"       
       
----------------------------------------------------------------------------------------------------------------------------  
--   Output from above program
----------------------------------------------------------------------------------------------------------------------------
killer
k
-----------------------
>>Just<<
>>a<<
>>bunch<<
>>of<<
>>words<<
>>to<<
>>test<<
>>for<<
>>killer<<
>>items<<
>>containing<<
>>a<<
>>k<<
    

On 3/27/2014 7:07 AM, René Jansen wrote:
Hi Ramesh,

your contribution to the discussion is highly appreciated; thank you for the two links, they made for a better understanding of the current state of lambda.

There are indeed separate points to address. A NetRexx notation for "closures" and the point of the lambdafication of class library calls.

The first needs good design and a group decision that is in the tradition of Rexx. If we look at this as a modification of what was started with anonymous inner classes, it must become clear that the 'dependent' class construction that NetRexx uses does not really lend itself to adaptation in this direction (at least, my subjective impression here). The point of these was mostly that operations of GUI classes could be inlined (no great coincidence they popped up during Swing development) but the NetRexx variant placed these firmly out of the way into their own class files, or at least outside of the handling class.

When we see lambda's as a refinement in which even the Java language architects decided there was too much 'ceremony' then we ought to reflect on what would be the Rexx way to accomplish this, and how it would look so we will like it and use it.

I think you are right in the assessment that we must allow for the notation that enables the new, internal iteration primitives of the collection class. This is probably a lesser modification of the parser (as the damage only occurrs within the parentheses of the method call) but still someone must find the time to analyze & implement.

best regards,

René Jansen.


On 27 mrt. 2014, at 14:15, Ramesh Gopal <[hidden email]> wrote:

Hi Rene,

My thinking on this was shaped by 2 articles written by Brian Goetz, the Java Chief Language Architect:


and


It would appear that backwards compatibility in the libraries are preserved, as you correctly point out that existing NetRexx code already works on JVM 8. Brian Goetz also makes this point by noting "... we pursue an evolutionary strategy of adding extension methods to existing interfaces ...".

It is apparent from the above, however, that to exploit the new Collections and Streams features, NetRexx will need to support lambdas and possibly, generics.

I do not by any stretch of the imagination intend to dictate how NetRexx should evolve, but my thinking revolves around what is the raison d'etre of NetRexx.

If one concludes that:

a) NetRexx's main goal is to make Java programming easier, and bring some great high-level facilities from Rexx (such as PARSE, TRACE, arbitrary precision arithmetic, etc) into the Java world; and

b) NetRexx will continue to emit Java code instead of directly compiling to bytecode; then

the language certainly needs to adapt to the recent changes in Java. This makes NetRexx continue to be relevant for those of us who don't like Java's ceremonial syntax and for those of us who want to leverage some great Rexx facilities.

IMHO, we may need to look at adding generics, annotations and lambdas, so that converting Java code to NetRexx can be easily done. Otherwise, we may need to still write stuff in Java when NetRexx can't (easily) do the job, and then call that Java code from NetRexx. This necessitates a developer having to know both Java and NetRexx sufficiently well in order to do this.

Another thing to consider is NetRexx's "competition".

I have recently learnt that some Java developers have also been thinking about getting rid of Java's ceremonial syntax, and they succeeded by creating Xtend (https://www.eclipse.org/xtend/). Like NetRexx, Xtend gets rid of Java ceremony, and it also translates Xtend code into Java code.

Hope my ramblings help and make sense!



On Thu, Mar 27, 2014 at 6:46 PM, René Jansen <[hidden email]> wrote:
Hi Ramesh,

thanks for thinking of this. Do you have a specific example?

As George stated earlier, by splitting up the generation of Java source and then using a compiler (and we can use several) we are always at the current bytecode level as long as the compiler backed generates it.
I am not sure that the library people will want to invalidate KLOCS of Java code by changing the calling convention; and by that argument all NetRexx code will also be safe.

As for the "going to target running on JVM 8", we are for a long time already testing on weekly builds, and have no test cases failing on Java 8, not even the interpreted code.

It would be great if you could supply an example of what you think might go wrong, so we can focus on starting fixing it.

Apart from that, I am not at all opposed to enable this nifty notation in NetRexx.

best regards,

René Jansen.


On 27 mrt. 2014, at 04:35, Ramesh Gopal <[hidden email]> wrote:

> The decision to modify the NetRexx translator to emit Java 8 idiomatic code
> *may not* be completely optional. My reading of the latest Java 8 changes
> seem to indicate that the Java developers have embedded lambdas deep into
> the standard libraries.
>
> What this seems to suggest to me is that if NetRexx is going to target
> running on JVM 8, then the emitted code will likely need to make calls to
> the standard libraries using the new lambda conventions.
>
> However, my reading of the changes does not seem to suggest one way or
> another whether the standard libraries will support dual interfaces, i.e.
> the old way of invocation without lambdas (for JDK 7 and earlier) , and the
> new way with lambdas (for JDK 8 and later).
>
>
>
>
> --
> View this message in context: http://ibm-netrexx.215625.n3.nabble.com/Java-8-and-Lambdas-tp4026954p4026970.html
> Sent from the ibm-netrexx mailing list archive at Nabble.com.
>
> _______________________________________________
> Ibm-netrexx mailing list
> [hidden email]
> Online Archive : http://ibm-netrexx.215625.n3.nabble.com/
>

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


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




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



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

Reply | Threaded
Open this post in threaded view
|

Re: Java 8 and Lambdas

Tom Maynard

On 04-Apr-14 03:23, Kermit Kiser wrote:
a short test...using hard coded Predicate and Consumer classes
Could we see the source for those, too, please? 

Let me be clear: I never felt that NetRexx *needed* lambda expressions -- as you demonstrate with your workaround here.  Plenty of alternate languages for the JVM lack lambdas and they do very well indeed.  It's just that in many instances (perhaps even in your test case) they make things a bit cleaner, and often also more intuitive.

I don't think "Functional Programming in NetRexx" is going to be the next big thing, so it's also no big deal.  Just a thought....  (I always get in trouble when I start thinking.)

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

12