Andrei Alexandrescu <> changed:

           What    |Removed                     |Added
            Summary|TDPL: Function literals     |[tdpl] Function literals
                   |must be deduced as          |must be deduced as
                   |"function" or "delegate"    |"function" or "delegate"

--- Comment #6 from Andrei Alexandrescu <> 2011-12-18 
20:05:41 PST ---
The following example is in TDPL:

  auto f = (int i) {};
  assert(is(f == function));

The example fails to compile (it should). Also the following example should

  int a;
  auto f = (int i) { a = i; };
  assert(is(f == delegate));

The compiler should automatically infer function or delegate type depending on
the literal's use of local state. The argument against it - people change a
detail in the body of the function and its type changes - is non sequitur.
Changing a literal from 10 to 10.0 also changes its type. Please fix.

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

Reply via email to