digitalmars.D.bugs - [Issue 8364] New: Allow exclamation mark in template definition
- d-bugmail puremagic.com (20/20) Jul 09 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8364
- d-bugmail puremagic.com (11/13) Jul 09 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8364
- d-bugmail puremagic.com (15/15) Jul 09 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8364
- d-bugmail puremagic.com (21/29) Jul 09 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8364
- d-bugmail puremagic.com (12/13) Jul 10 2012 Because one syntax is easier to learn than two. Timon said "when I wrote...
http://d.puremagic.com/issues/show_bug.cgi?id=8364 Summary: Allow exclamation mark in template definition Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: enhancement Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: qwertie256 gmail.com --- Comment #0 from David Piepgrass <qwertie256 gmail.com> 2012-07-09 13:12:42 PDT --- The syntax of templates should be similar at the definition as it is at the call site: T sum!(T,R)(R range) if (isInputRange!R...) { ... } Of course, the existing syntax must be kept too. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 09 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8364 bearophile_hugs eml.cc changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bearophile_hugs eml.cc --- Comment #1 from bearophile_hugs eml.cc 2012-07-09 13:17:24 PDT --- (In reply to comment #0)The syntax of templates should be similar at the definition as it is at the call site:Why? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 09 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8364 Jonathan M Davis <jmdavisProg gmx.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jmdavisProg gmx.com --- Comment #2 from Jonathan M Davis <jmdavisProg gmx.com> 2012-07-09 13:25:16 PDT --- Of what value is that? The current situation is wonderfully unambiguous. This proposal would make the parser's life harder and would probably make it so that the grammar could no longer be context free (which would be very bad). And from the perspective of the programmer (not just the compiler), it's _useful_ to be able to tell the difference between a template and a template instantiation at a glance. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 09 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8364 timon.gehr gmx.ch changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |timon.gehr gmx.ch --- Comment #3 from timon.gehr gmx.ch 2012-07-09 13:36:26 PDT --- (In reply to comment #2)Of what value is that? The current situation is wonderfully unambiguous.True.This proposal would make the parser's life harderNot really. Having this as the only template declaration syntax would even make the parser's life easier. (and if both were legal, parsing the kind that has the '!' would be slighly more efficient.)and would probably make it so that the grammar could no longer be context freeThis is not the case. The grammar would stay context free.(which would be very bad). And from the perspective of the programmer (not just the compiler), it's _useful_ to be able to tell the difference between a template and a template instantiation at a glance.The proposal does not put this ability in danger. Anyway, I don't prefer either scheme and in my opinion it is fine to either leave the template declaration grammar as it is, or to change it to always require '!'. The latter is not going to happen though. (I remember that when I wrote my very first function template in D, I used the proposed syntax and was confused that it didn't work.) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 09 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8364 --- Comment #4 from David Piepgrass <qwertie256 gmail.com> 2012-07-10 12:31:37 PDT ---Why?Because one syntax is easier to learn than two. Timon said "when I wrote my very first function template in D, I used the proposed syntax and was confused that it didn't work", and that makes two of us (well, I quickly realized why the compiler complained, but my first instinct is to use !, and it feels really dumb that I can't). Plus, the parser might be able to handle ! more quickly, since it will know to expect "TemplateParameterList" instead of "Parameters". -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 10 2012