[Issue 7947] typeof on anonymous function literal returns void

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Apr 20 04:38:38 PDT 2012


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


bearophile_hugs at eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs at eml.cc


--- Comment #2 from bearophile_hugs at eml.cc 2012-04-20 04:39:34 PDT ---
(In reply to comment #1)

> And, long years, typeof(template) returns void.
> Therefore, typeof(x => x) == void is current implementation design.
> 
> I don't know why typeof(template) returns void, but changing the behavior will
> break some existing meta-programming codes.

I think it's acceptable to break such meta-programming code. I think
pragma(msg, typeof(tem)); should show something useful when tem is a template
function (like the name of the template if it has a name, or a lambda template
plus line number if it has no name).

There are people working on an algorithm to automatically synthesize good names
for anonymous functions, but probably it's overkill in D "Naming Anonymous
JavaScript Functions":

http://blog.getfirebug.com/2011/04/28/naming-anonymous-javascript-functions/

http://code.google.com/p/querypoint-debugging/downloads/detail?name=NamingJSFunctions.pdf

-- 
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