digitalmars.D.bugs - [Issue 4530] New: Tidier function types
- d-bugmail puremagic.com (25/25) Jul 28 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4530
- d-bugmail puremagic.com (15/19) Jul 28 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4530
- d-bugmail puremagic.com (16/19) Jul 28 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4530
- d-bugmail puremagic.com (7/7) Jul 29 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4530
- d-bugmail puremagic.com (11/11) Jul 29 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4530
- d-bugmail puremagic.com (6/6) Aug 03 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4530
- d-bugmail puremagic.com (20/20) Jun 15 2011 http://d.puremagic.com/issues/show_bug.cgi?id=4530
http://d.puremagic.com/issues/show_bug.cgi?id=4530 Summary: Tidier function types Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: enhancement Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: bearophile_hugs eml.cc This is a valid D2 code (dmd 2.047): import std.stdio; void main() { string a(); } Allowing/keeping ugly and error-prone function literals in D2 is bad. It's better for D2 to keep/allow only _one_ standard, clean and readable syntax for functions pointers (and one for delegates, if necessary). Keeping C function pointer syntax or something similar in D2 causes troubles. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 28 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4530 Justin Spahr-Summers <Justin.SpahrSummers gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |Justin.SpahrSummers gmail.c | |om 2010-07-28 18:17:15 CDT ---Allowing/keeping ugly and error-prone function literals in D2 is bad. It's better for D2 to keep/allow only _one_ standard, clean and readable syntax for functions pointers (and one for delegates, if necessary). Keeping C function pointer syntax or something similar in D2 causes troubles.'a' is not a function literal... it's a declaration of a nested function. The C syntax for a function pointer would be: string (*a)(); which I think is pretty unambiguous. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 28 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4530 Stewart Gordon <smjg iname.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |smjg iname.comstring (*a)(); which I think is pretty unambiguous.It isn't. Could be a function called string, which is being called with argument (*a), and the function returned from that call then called with an empty argument list. D grammar aims to be unambiguous. Removing C-style casts has already been a step in the right direction. Removing C-style function pointer declarations would be another. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 28 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4530 09:21:49 PDT --- Or a static opCall on the string type. Or an extension method opCall(string b, int a){...} -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 29 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4530 But as far as the parser is concerned, that's still a function call. It's the semantic analyser that identifies whether string is an actual function, a function pointer or delegate, a type on which a static opCall is defined, an object of a type that has an opCall, or whatever. A function pointer declaration, on the other hand, is a syntactical form distinct from all of these. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 29 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4530 See also enhancement request 4580 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 03 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4530 yebblies <yebblies gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |yebblies gmail.com Resolution| |INVALID In the original comment, there is no 'ugly and error-prone function literal'. There is a nested function declaration with no body. import std.stdio; void main() { string a(); pragma(msg, typeof(&a)); } Prints: string delegate() -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 15 2011