digitalmars.D.bugs - [Issue 2945] New: Precedence of 'new' vs '.'
- d-bugmail puremagic.com (20/20) May 05 2009 http://d.puremagic.com/issues/show_bug.cgi?id=2945
- d-bugmail puremagic.com (15/15) May 06 2009 http://d.puremagic.com/issues/show_bug.cgi?id=2945
- d-bugmail puremagic.com (8/20) May 06 2009 http://d.puremagic.com/issues/show_bug.cgi?id=2945
- d-bugmail puremagic.com (8/10) May 06 2009 http://d.puremagic.com/issues/show_bug.cgi?id=2945
- d-bugmail puremagic.com (12/12) Jan 11 2013 http://d.puremagic.com/issues/show_bug.cgi?id=2945
http://d.puremagic.com/issues/show_bug.cgi?id=2945
Summary: Precedence of 'new' vs '.'
Product: D
Version: 1.042
Platform: PC
OS/Version: All
Status: NEW
Severity: enhancement
Priority: P2
Component: DMD
AssignedTo: bugzilla digitalmars.com
ReportedBy: benoit tionex.de
In Java one can write:
new MyClass().run();
in D this does not compile, parenthesis are needed.
(new MyClass()).run();
I think this should behave like Java.
See also
http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=89433
--
May 05 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2945
matti.niemenmaa+dbugzilla iki.fi changed:
What |Removed |Added
----------------------------------------------------------------------------
Platform|PC |All
-------
There might be a problem here in that in D you can write it without the
brackets:
new MyClass.Foo;
Is the above trying to create a new Myclass.Foo or is it trying to create a new
MyClass and then access its Foo member? It depends on the type of Foo, and such
a dependency is, I think, what Walter has been trying to avoid.
Nevertheless, I often forget the brackets myself and wouldn't mind this change,
I just think the above means that it's not going to happen.
--
May 06 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2945There might be a problem here in that in D you can write it without the brackets: new MyClass.Foo; Is the above trying to create a new Myclass.Foo or is it trying to create a new MyClass and then access its Foo member? It depends on the type of Foo, and such a dependency is, I think, what Walter has been trying to avoid. Nevertheless, I often forget the brackets myself and wouldn't mind this change, I just think the above means that it's not going to happen.Ceraintly. However, new MyClass().Foo; has no such ambiguity until D becomes capable of returning types from functions. -- Simen --
May 06 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2945Ceraintly. However, new MyClass().Foo; has no such ambiguity until D becomes capable of returning types from functions.Traditionally, runtime reflection like that is done by calling methods on the returned type, not by using a compile-time operator. So it would look more like: MyClass.Foo.instantiate(); --
May 06 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2945
Andrej Mitrovic <andrej.mitrovich gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |andrej.mitrovich gmail.com
Resolution| |DUPLICATE
19:44:14 PST ---
*** This issue has been marked as a duplicate of issue 8635 ***
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 11 2013









d-bugmail puremagic.com 