[Oberon] Life without local procedures

Diego Sardina dsar at eml.cc
Sat Feb 24 18:54:21 CET 2018


On Sat, Feb 24, 2018, at 2:02 PM, Claudio Nieder wrote:
> Hi,
> 
> Maybe nicer using functions:
> 
> package test;
> 
> import java.util.function.Function;
> 
> public class Global
> {
>  public static void main(final String[] a)
>  {
>   final int i=5;
>   final Function<Integer,Integer> q=x -> {
>    return x*i;
>   };
>   System.out.println(q.apply(7));
>  }
> }
> 

Lambda expressions are allocated in heap, so they are not
really cheap as Modula-2/Oberon local procedures.

Although this is not really a problem since in Java almost
everything is allocated on heap :-)

But imho they are too heavyweight for this use case.



More information about the Oberon mailing list