class instance construction

2010-11-11 Thread spir
Hello, First, what is the actual point of new? I find this keyword rather helpful in that it reminds me the element is referenced/heap-allocated/GC'ed. But is there any ambiguity on the language's side? We cannot construct a class instance in any other way, AFAIK, and calling a class can

Re: class instance construction

2010-11-11 Thread Simen kjaeraas
spir denis.s...@gmail.com wrote: First, what is the actual point of new? Mostly, it's a remnant from C++. I find this keyword rather helpful in that it reminds me the element is referenced/heap-allocated/GC'ed. But is there any ambiguity on the language's side? We cannot construct a

Re: class instance construction

2010-11-11 Thread Justin Johansson
On 11/11/10 20:02, spir wrote: Hello, First, what is the actual point of new? I find this keyword rather helpful in that it reminds me the element is referenced/heap-allocated/GC'ed. But is there any ambiguity on the language's side? We cannot construct a class instance in any other way,

Re: class instance construction

2010-11-11 Thread Daniel Gibson
spir schrieb: Still, an other case when new annoys me is method chaining, because it makes syntax heavier and less readable: c = (new C(p)).do(x); versus: c = C(p).do(x); Or, maybe, the parser could be clever enough to correctly decode: c = new C(p).do(x); Is this

Re: class instance construction

2010-11-11 Thread Steven Schveighoffer
On Thu, 11 Nov 2010 11:57:40 -0500, Daniel Gibson metalcae...@gmail.com wrote: spir schrieb: Still, an other case when new annoys me is method chaining, because it makes syntax heavier and less readable: c = (new C(p)).do(x); versus: c = C(p).do(x); Or, maybe, the parser

Re: class instance construction

2010-11-11 Thread Steven Schveighoffer
On Thu, 11 Nov 2010 12:10:42 -0500, Steven Schveighoffer schvei...@yahoo.com wrote: On Thu, 11 Nov 2010 11:57:40 -0500, Daniel Gibson metalcae...@gmail.com wrote: spir schrieb: Still, an other case when new annoys me is method chaining, because it makes syntax heavier and less readable:

Re: class instance construction

2010-11-11 Thread Daniel Gibson
Steven Schveighoffer schrieb: On Thu, 11 Nov 2010 12:10:42 -0500, Steven Schveighoffer schvei...@yahoo.com wrote: On Thu, 11 Nov 2010 11:57:40 -0500, Daniel Gibson metalcae...@gmail.com wrote: spir schrieb: Still, an other case when new annoys me is method chaining, because it makes

Re: class instance construction

2010-11-11 Thread spir
On Thu, 11 Nov 2010 17:57:40 +0100 Daniel Gibson metalcae...@gmail.com wrote: spir schrieb: Still, an other case when new annoys me is method chaining, because it makes syntax heavier and less readable: c = (new C(p)).do(x); versus: c = C(p).do(x); Or, maybe, the parser

Re: class instance construction

2010-11-11 Thread spir
On Thu, 11 Nov 2010 18:53:56 +0100 Daniel Gibson metalcae...@gmail.com wrote: That being said, I'm really ambivalent on whether this needs to be included. It's not that terrible that you have to parenthesize properly. Also, I'm not sure if this is a common case.. although I had similar