First draft of translation document

Howard Lovatt howard.lovatt at gmail.com
Wed May 19 18:09:25 PDT 2010


Rémi Forax<forax at univ-mlv.fr>  wrote:
>Le 19/05/2010 05:31, Neal Gafter a écrit :
>> On Tue, May 18, 2010 at 6:02 PM, Rémi Forax<forax at univ-mlv.fr>  wrote:

[snip]

> The problem with shared variables is that you break the assumption
> that you have sequential ordering of local variables.
> I don't see why we should offer a feature with such semantics.
>
> void f() {
>    shared String s = "hello";
>    Utils.perhapsRunInAnotherThread(#() {
>      System.out.println(s); // may or may not prints null
>    });
> }
>
> The Java memory model is sufficiently complicated to not add more
> subtilities.

This is one of the reasons I wrote an alternate translation, if you
are going to have to have a stack frame object, multiple binds to the
MethodHandles, interface injection to the MethodHandle, then I am
speculating that a single Frame object that does the lot will be
faster:

private static class Frame_1 extends Frame1<String> implements Callable0V {
  Frame_1( final String s ) { super( s ); }

  public Void _call() { _call0V(); return null; }

  public void _call0V() { System.out.println( _e1 ); }
}

void f() {
   final Frame_1 frame_1 = new Frame_1( "hello" );
   Utils.perhapsRunInAnotherThread( frame_1 );
}


  -- Howard.


More information about the lambda-dev mailing list