Thread overview | |||||||||
---|---|---|---|---|---|---|---|---|---|
|
July 28, 2010 [Issue 4530] New: Tidier function types | ||||
---|---|---|---|---|
| ||||
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 --- Comment #0 from bearophile_hugs@eml.cc 2010-07-28 15:30:47 PDT --- 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: ------- |
July 28, 2010 [Issue 4530] Tidier function types | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | 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 --- Comment #1 from Justin Spahr-Summers <Justin.SpahrSummers@gmail.com> 2010-07-28 18:17:15 CDT --- (In reply to comment #0) > 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: ------- |
July 28, 2010 [Issue 4530] Tidier function types | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=4530 Stewart Gordon <smjg@iname.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |smjg@iname.com --- Comment #2 from Stewart Gordon <smjg@iname.com> 2010-07-28 16:40:28 PDT --- (In reply to comment #1) > string (*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: ------- |
July 29, 2010 [Issue 4530] Tidier function types | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=4530 --- Comment #3 from Sobirari Muhomori <dfj1esp02@sneakemail.com> 2010-07-29 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: ------- |
July 29, 2010 [Issue 4530] Tidier function types | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=4530 --- Comment #4 from Stewart Gordon <smjg@iname.com> 2010-07-29 14:51:27 PDT --- 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: ------- |
August 04, 2010 [Issue 4530] Tidier function types | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=4530 --- Comment #5 from bearophile_hugs@eml.cc 2010-08-03 18:13:23 PDT --- See also enhancement request 4580 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
June 15, 2011 [Issue 4530] Tidier function types | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | 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 --- Comment #6 from yebblies <yebblies@gmail.com> 2011-06-15 07:59:44 PDT --- 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: ------- |
Copyright © 1999-2021 by the D Language Foundation