Thread overview | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
September 09, 2012 [Issue 8635] New: Allow postfix expressions for new | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=8635 Summary: Allow postfix expressions for new Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: enhancement Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: timon.gehr@gmx.ch --- Comment #0 from timon.gehr@gmx.ch 2012-09-09 07:35:29 PDT --- New expressions should have support for postfixes, eg. like so: class C{ int x; this(int x) { this.x = x; } } void main() { assert(new C(2).x==2); assert(new C(3).x==3); } Necessary grammar changes: UnaryExpression: ... ( Type ) . Identifier - NewExpression ... PrimaryExpression: ... ImportExpression + NewExpression BasicType . Identifier ... -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
September 09, 2012 [Issue 8635] Allow postfix expressions for new | ||||
---|---|---|---|---|
| ||||
Posted in reply to timon.gehr@gmx.ch | http://d.puremagic.com/issues/show_bug.cgi?id=8635 bearophile_hugs@eml.cc changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bearophile_hugs@eml.cc --- Comment #1 from bearophile_hugs@eml.cc 2012-09-09 07:50:29 PDT --- This seems a nice idea. See also: https://github.com/D-Programming-Language/dmd/pull/1111 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
September 09, 2012 [Issue 8635] Allow postfix expressions for new | ||||
---|---|---|---|---|
| ||||
Posted in reply to timon.gehr@gmx.ch | http://d.puremagic.com/issues/show_bug.cgi?id=8635 Jonathan M Davis <jmdavisProg@gmx.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jmdavisProg@gmx.com --- Comment #2 from Jonathan M Davis <jmdavisProg@gmx.com> 2012-09-09 16:45:01 PDT --- It already works if you use parens: assert((new C(2)).x == 2); I don't know if making it work without parens is a good idea or not, since I really don't know that the side effects of that would be. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
September 10, 2012 [Issue 8635] Allow postfix expressions for new | ||||
---|---|---|---|---|
| ||||
Posted in reply to timon.gehr@gmx.ch | http://d.puremagic.com/issues/show_bug.cgi?id=8635 --- Comment #3 from bearophile_hugs@eml.cc 2012-09-09 17:49:31 PDT --- (In reply to comment #2) > I don't know if making it work without parens is a good idea or not, since I really don't know that the side effects of that would be. I agree. If the side effects are bad, this bug report will be closed and future similar ideas will be marked as duplicates of this :-) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
September 10, 2012 [Issue 8635] Allow postfix expressions for new | ||||
---|---|---|---|---|
| ||||
Posted in reply to timon.gehr@gmx.ch | http://d.puremagic.com/issues/show_bug.cgi?id=8635 --- Comment #4 from timon.gehr@gmx.ch 2012-09-09 18:08:59 PDT --- There are no side effects. This just lifts a trivial restriction. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
September 10, 2012 [Issue 8635] Allow postfix expressions for new | ||||
---|---|---|---|---|
| ||||
Posted in reply to timon.gehr@gmx.ch | http://d.puremagic.com/issues/show_bug.cgi?id=8635 Alex Rønne Petersen <alex@lycus.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |alex@lycus.org --- Comment #5 from Alex Rønne Petersen <alex@lycus.org> 2012-09-10 03:26:32 CEST --- Also, it's how C# (and probably Java too) does it. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
September 10, 2012 [Issue 8635] Allow postfix expressions for new | ||||
---|---|---|---|---|
| ||||
Posted in reply to timon.gehr@gmx.ch | http://d.puremagic.com/issues/show_bug.cgi?id=8635 --- Comment #6 from Jonathan M Davis <jmdavisProg@gmx.com> 2012-09-09 18:31:47 PDT --- I have absolutely no problem with this as long as there are no side effects. I just had figured that there was a valid reason why the parens were required. It's often the case that something will seem like it should work and doesn't but has a very good reason for why it doesn't, even if it looks fine at first glance. > Also, it's how C# (and probably Java too) does it. Given D's increased complexity, it wouldn't surprise me at all if D couldn't do it when they could, but if it can, it definitely should as well. I think that it's the syntax that pretty much everyone tries at first - only to find that it doesn't work. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
September 10, 2012 [Issue 8635] Allow postfix expressions for new | ||||
---|---|---|---|---|
| ||||
Posted in reply to timon.gehr@gmx.ch | http://d.puremagic.com/issues/show_bug.cgi?id=8635 --- Comment #7 from timon.gehr@gmx.ch 2012-09-09 18:40:01 PDT --- (In reply to comment #6) > I have absolutely no problem with this as long as there are no side effects. I just had figured that there was a valid reason why the parens were required. ... Presumably it is just a C++ism that got carried over for no reason. > Given D's increased complexity, The D grammar is not particularly complex. (it is still somewhat more complex than it would need to be though.) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
December 08, 2012 [Issue 8635] Allow postfix expressions for new | ||||
---|---|---|---|---|
| ||||
Posted in reply to timon.gehr@gmx.ch | http://d.puremagic.com/issues/show_bug.cgi?id=8635 Andrej Mitrovic <andrej.mitrovich@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |wfunction@hotmail.com --- Comment #8 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2012-12-08 15:10:55 PST --- *** Issue 8116 has been marked as a duplicate of this issue. *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
January 08, 2013 [Issue 8635] Allow postfix expressions for new | ||||
---|---|---|---|---|
| ||||
Posted in reply to timon.gehr@gmx.ch | http://d.puremagic.com/issues/show_bug.cgi?id=8635 yebblies <yebblies@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |aziz.koeksal@gmail.com --- Comment #9 from yebblies <yebblies@gmail.com> 2013-01-08 12:08:11 EST --- *** Issue 8826 has been marked as a duplicate of this issue. *** -- 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