Hi Jochen,
Thanks a lot for your detailed explanation block by block!
> If you use the Closure code, then variables used in Closures are marked
> as Reference even if they are only read
According to your suggestion, I've fixed the loading variable issue[1]
:-)
Thanks for you
Am 15.01.2018 um 10:53 schrieb Daniel Sun:
Hi Jochen,
`ArrayIndexOutOfBoundsException` is fixed. I encounter another
problem(i.e. How to load arguments according to some specified order): I
want to load local variables[1] according to the order in which the local
variables appear in lamb
Hi Jochen,
I still have a quesiton: How can I load variables via Groovy
utilities? Here[1] is my current way to load varaibles, it is not correct
though it can compile and run(i.e. the related test can not pass[2]):
I tried the following way, but error occurred[3]...
```
int
Am 15.01.2018 um 15:21 schrieb Daniel Sun:
Hi Jesper,
Thanks for your advice :-)
That's much easier than making the order dependent on the usage.
Actually javac makes the order dependent on the local variables usage
in the lambda body. I'll follow its way for the time being bec
Hi Jesper,
Thanks for your advice :-)
> That's much easier than making the order dependent on the usage.
Actually javac makes the order dependent on the local variables usage
in the lambda body. I'll follow its way for the time being because I can
reference how it make lambda work ;-)
Hi Daniel
> On 15 Jan 2018, at 10.53, Daniel Sun wrote:
>
> Hi Jochen,
>
> `ArrayIndexOutOfBoundsException` is fixed. I encounter another
> problem(i.e. How to load arguments according to some specified order): I
> want to load local variables[1] according to the order in which the local
>
Hi Jochen,
`ArrayIndexOutOfBoundsException` is fixed. I encounter another
problem(i.e. How to load arguments according to some specified order): I
want to load local variables[1] according to the order in which the local
variables appear in lambda body. For example:
(1)
```
String x =
Hi Jochen,
Thanks for your detailed explanation, which is very helpful to me.
Cheers,
Daniel.Sun
--
Sent from: http://groovy.329449.n5.nabble.com/Groovy-Dev-f372993.html
On 14.01.2018 01:10, Daniel Sun wrote:
Hi Jochen,
What I wish for in a static compile lambda is the following:
* bar is a parameter to the method generated for the lambda
I am trying to make native lambda support sharing local variables, but ASM
reports the following error[1]:
Caused by: java
It seems that I found where go wrong.
The shared local variables in generated method body should have been
replaced with parameters. Let me try later :-)
Cheers,
Daniel.Sun
--
Sent from: http://groovy.329449.n5.nabble.com/Groovy-Dev-f372993.html
Hi Jochen,
> What I wish for in a static compile lambda is the following:
> * bar is a parameter to the method generated for the lambda
I am trying to make native lambda support sharing local variables, but ASM
reports the following error[1]:
Caused by: java.lang.ArrayIndexOutOfBoundsException:
BTW, https://github.com/danielsun1106/SmartASMifier can help us view bytecode
easily ;-)
Cheers,
Daniel.Sun
--
Sent from: http://groovy.329449.n5.nabble.com/Groovy-Dev-f372993.html
this looks quite promising
On 13.01.2018 12:24, Daniel Sun wrote:
Hi Jochen,
Here is an example:
```
import java.util.stream.Collectors;
import java.util.stream.Stream;
public class Test1 {
public static void main(String[] args) {
p();
}
public static void p()
On 13.01.2018 04:07, Nathan Harvey wrote:
Sure thing. Here's a Java example:
void sample(Function fn) {
System.out.println("fn");
}
void sample(Supplier sp) {
System.out.println("sp");
}
These methods can exist side by side, and are c
Hi Jochen,
Here is an example:
```
import java.util.stream.Collectors;
import java.util.stream.Stream;
public class Test1 {
public static void main(String[] args) {
p();
}
public static void p() {
Stream.of(1, 2, 3).map(e -> e + 1).collect(Collectors.toList());
Sure thing. Here's a Java example:
void sample(Function fn) {
System.out.println("fn");
}
void sample(Supplier sp) {
System.out.println("sp");
}
These methods can exist side by side, and are called correctly even in cases
of Lambda, eg:
On 13.01.2018 01:00, Nathan Harvey wrote:
On the other hand, lambdas are superior for functional programming because
they can be differentiated with Java 8's functional type classes quite
easily.
Could you give an example on what exactly you mean by that, and in what
sense you see them as be
One of the largest reasons I found myself preferring Groovy over Java is the
quasi-final scoping restrictions of Lambdas. Please do not let this behavior
exist in Groovy. It makes functional programming very hard.
On the other hand, lambdas are superior for functional programming because
they can
Am 12.01.2018 um 18:54 schrieb Russel Winder:
On Fri, 2018-01-12 at 05:54 -0700, Daniel.Sun wrote:
[…]
As you see, the latest implementation is to generate method for lambda
at the class generation stage, in addition new inner classes will be
generated for each lambda.
[…]
I haven't
Am 12.01.2018 um 15:00 schrieb Daniel Sun:
Hi Jochen,
but I think you should then not use the closure inner class mechanism.
I remain the implementation for non-native lambda[1] to make lambda work in
legacy code, where closures are widely used. For example, `[1, 2,
3].collect(e -> e + 1)`
On Fri, 2018-01-12 at 05:54 -0700, Daniel.Sun wrote:
>
[…]
> As you see, the latest implementation is to generate method for lambda
> at the class generation stage, in addition new inner classes will be
> generated for each lambda.
>
> […]
I haven't read the code, I am reacting to the above
Am 12.01.2018 um 14:13 schrieb Daniel.Sun:
Hi Jesper,
The bytecode generation for lambda of the current implementation
should be somehow same with javac does, because I reference the ASM code,
which is decomplied from bytecode generated by javac.
If you have some spare time to c
Hi Jochen,
> I did also not understand the innclass attribute visit...
I've cleaned up the useless code:
https://github.com/apache/groovy/commit/6aeaa1c5a7863af5d2c126a5bdf9da9aff2a8db6
Cheers,
Daniel.Sun
--
Sent from: http://groovy.329449.n5.nabble.com/Groovy-Dev-f372993.html
Hi Jochen,
> but I think you should then not use the closure inner class mechanism.
I remain the implementation for non-native lambda[1] to make lambda work in
legacy code, where closures are widely used. For example, `[1, 2,
3].collect(e -> e + 1)`
> I thought you need that only to enable reflec
Hi Jesper,
The bytecode generation for lambda of the current implementation
should be somehow same with javac does, because I reference the ASM code,
which is decomplied from bytecode generated by javac.
If you have some spare time to contribute, glad to work with you again
;-)
Cheer
Hi Jochen,
Thanks for your reviewing the code. They are a bit old because I pushed
the latest commit this afternoon :-)
As you see, the latest implementation is to generate method for lambda
at the class generation stage, in addition new inner classes will be
generated for each lambda.
Hi Jochen and Daniel
> On 12 Jan 2018, at 12.48, Jochen Theodorou wrote:
>
>
>
> Am 12.01.2018 um 04:05 schrieb Daniel Sun:
>> Hi Nathan,
>>> What's will the differences be between closures and lambdas?
>> The native lambda will have better performance than closure. In addition,
>> native lamb
Am 12.01.2018 um 04:05 schrieb Daniel Sun:
Hi Nathan,
What's will the differences be between closures and lambdas?
The native lambda will have better performance than closure. In addition,
native lambda, which conforms to Java specification, is less versatile than
closure, which is really p
Hi Nathan,
> What's will the differences be between closures and lambdas?
The native lambda will have better performance than closure. In addition,
native lambda, which conforms to Java specification, is less versatile than
closure, which is really powerful...
Cheers,
Daniel.Sun
--
Sent from
Time is the problem, but I'll try to set aside some time to push the progress
;-)
Cheers,
Daniel.Sun
--
Sent from: http://groovy.329449.n5.nabble.com/Groovy-Dev-f372993.html
Great work, Daniel. What's will the differences be between closures and
lambdas? I love that you can have fine control over closure scoping, but
lambdas play very well with functional interfaces, which are very important!
--
Sent from: http://groovy.329449.n5.nabble.com/Groovy-Dev-f372993.html
Awesome to see progress on this. Keep it up!
On Thu, Jan 11, 2018 at 9:07 AM, Daniel Sun wrote:
> Hi all,
>
> I created the native-lambda branch and pushed the first commit to
> support very basic native lambda in the static compilation mode[1]. After
> native lambda is fully supported in t
Hi all,
I created the native-lambda branch and pushed the first commit to
support very basic native lambda in the static compilation mode[1]. After
native lambda is fully supported in the static compilation mode, I will try
to make native lambda work in the dynamic compilation mode(I wish I
33 matches
Mail list logo