Summary: Lambda => syntax for function and methods too
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD

--- Comment #0 from 2011-12-28 05:11:07 PST ---
(From an idea of Timon Gehr)

I think extending the applicability of the new lambda syntax to free
functions/methods is a nice idea, to shorten tiny functions/methods, that are
common enough:

struct C {
    int x;
    int getX() => x;
    int sqrX() => x ^^ 2;

Some examples from other languages:

A function to compute the arithmetic mean in Scala 2.7:

def mean(s: Seq[Int]) = s.foldLeft(0)(_+_) / s.size

>From the Ada 2012 changes:

> To simplify the writing of pre/postconditions and predicates, allow 
> parametrized expressions (aka function bodies in package specs):

function Cube (X : integer) is (X ** 3);

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to