Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [tracecompass-dev] Let's Lambda!

Interesting: If you have this line:

addMouseWheelListener(event -> System.out.println(event));

And put a breakpoint on it, it will break both when you add the listener and when the listener is invoked.

Not so bad, but it would be better to be able to trigger them separately.


On Wed, Apr 13, 2016 at 10:51 AM, Matthew Khouzam <matthew.khouzam@xxxxxxxxxxxx> wrote:
I have no issues with that, except for trivial lambdas.
My definition of a trivial lambda?

()->{true;}
or worst case:
(Object o)->{o.toString()}

Objections?

On 16-04-12 03:40 PM, Patrick Tasse wrote:
> I'm not against lambdas although it's a pity that due to the change in
> indentation it will affect a lot of the git blame annotations.
>
> But I would very much prefer that we avoid one-liner lambdas (e.g. put
> the lambda body in a block on its own line) so that we can put
> breakpoints and/or use Ctrl+R (Run to Line) when debugging.
>
> Patrick
>
> On Mon, Apr 11, 2016 at 1:06 PM, Matthew Khouzam
> <matthew.khouzam@xxxxxxxxxxxx <mailto:matthew.khouzam@xxxxxxxxxxxx>>
> wrote:
>
>     For those who want to go deeper.
>
>     http://www.infoq.com/articles/Java-8-Lambdas-A-Peek-Under-the-Hood
>
>     On 16-04-11 01:05 PM, Matthew Khouzam wrote:
>     > So I was thinking about how great our code looks, and we need to
>     keep up
>     > our efforts to keep it as clean as possible. I am going to suggest
>     > something, feel free to shoot it down.
>     >
>     > If you are writing an anon class or a listener, consider using a
>     lambda
>     > _expression_ instead. It will not make an object and therefore should
>     > reduce the quantity of objects allocated.
>     >
>     > The lambda will also encourage statelessness and therefore
>     potentially
>     > reduce leaks.
>     >
>     > Finally it will make our code more compact. I am not saying it's
>     more
>     > readable, but we can get more code on our screen at any moment,
>     and that
>     > is a good thing.
>     >
>     > Thoughts?
>     > _______________________________________________
>     > tracecompass-dev mailing list
>     > tracecompass-dev@xxxxxxxxxxx <mailto:tracecompass-dev@xxxxxxxxxxx>
>     > To change your delivery options, retrieve your password, or
>     unsubscribe from this list, visit
>     > https://dev.eclipse.org/mailman/listinfo/tracecompass-dev
>
>     _______________________________________________
>     tracecompass-dev mailing list
>     tracecompass-dev@xxxxxxxxxxx <mailto:tracecompass-dev@xxxxxxxxxxx>
>     To change your delivery options, retrieve your password, or
>     unsubscribe from this list, visit
>     https://dev.eclipse.org/mailman/listinfo/tracecompass-dev
>
>
>
>
> _______________________________________________
> tracecompass-dev mailing list
> tracecompass-dev@xxxxxxxxxxx
> To change your delivery options, retrieve your password, or unsubscribe from this list, visit
> https://dev.eclipse.org/mailman/listinfo/tracecompass-dev

_______________________________________________
tracecompass-dev mailing list
tracecompass-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/tracecompass-dev


Back to the top