[Issue 3235] Function literals must be deduced as "function" or "delegate"

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Aug 8 11:57:05 PDT 2009


Andrei Alexandrescu <andrei at metalanguage.com> changed:

           What    |Removed                     |Added
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |

--- Comment #4 from Andrei Alexandrescu <andrei at metalanguage.com>  2009-08-08 11:57:05 PDT ---
(In reply to comment #2)
> This is as designed.
> http://www.digitalmars.com/d/1.0/expression.html#FunctionLiteral
> "If the keywords function or delegate are omitted, it defaults to being a
> delegate."
> Having the type of a function/delegate literal depend on its contents like this
> makes it hard for someone reading the code to tell which it is.  Since function
> pointers and delegates are not generally interchangeable, AISI it's desirable
> to keep their literal notations distinct.

I think type deduction should help here as much as anywhere else. If you do
want a delegate, you can always use the delegate keyword. Plus, all algorithms
in std.algorithm take an efficiency toll when used with literals. 

(Please do not mark this as resolved; I've discussed with Walter before posting
it, and he suggested I do. In general, the spec of D2 is fluid enough to not be
a strong reason for invalidating a bug report. Thanks.)

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