[Issue 7176] Lambda => syntax for function and methods too

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Mar 20 13:33:51 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=7176



--- Comment #18 from timon.gehr at gmx.ch 2013-03-20 13:33:49 PDT ---
(In reply to comment #17)
> I don't like this feature. Because:
> 
> 1. it would reduce code readability.
> 

On the contrary! It also increases language consistency.

>    class LibClass {
>      int foo() { return 1; }
>      string bar() => "hi";
>    }
> 
>    Mixing lambda syntax and normal function syntax looks messy.
> 

No. It is normal function syntax that looks messy in this case.

class LibClass {
    auto foo() => 1;
    auto bar() => "hi";
}


> 2. Just only reducing 7 character is too small benefit.
> 

7*_N_ characters. Also, it can get rid of additional indentation.

>    auto foo()=>expr;
>    auto foo(){return expr;}
> 
>    With more complex function signature:
> 
>    ComplexReturnType!(..) foo(T, U, V)(T t, U u, V v) if (...)=>expr;
>    ComplexReturnType!(..) foo(T, U, V)(T t, U u, V v) if (...){return expr;}
> 
>    Ratio will fall further.

This is not a valid argument in any case.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list