491477 messages in 933 lists

> c0mrade wrote:
>
> Regarding the Python-style implementation, could groovy not 
> just look at something like "Class()" and think as so: "if 
> there is a function called 'Class', run that function. If 
> there is not a function called 'Class' look for any classes 
> called 'Class', if there is a class called 'Class' - return 
> 'Class.newInstance()'".

IMO omitting 'new' would weaken the language's expressive strength too much.

The code would become less understandable for the reader. But even worse,
the compiler's inference rules would become much more complex, probably up
to a point where it not even could decide to generate a NEW bytecode (think
e.g. of pretended methods). The decision what to invoke would then be left
to the runtime...

As you note, this argument does not neccessarily hold for the Ruby syntax

 TheClass.new(...)

as a syntactic equivalent for

 new TheClass(...)

However, personally I would not like to see this construct in Groovy. I
suspect it would force to drop the restrictions to 'new' from the grammar.
Would it allow to define methods with the name 'new'? If so, how should the
compiler separate constructor calls

 Xxx.new(...)

from method calls on an instance

 Xxx.new(...)


Regards,
Alex


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Message Thread
[groovy-user] Omit "new"? c0mrade (jacksingleton1@gmail...)
06 Jul 2008
Re: [groovy-user] Omit "new"? Guillaume Laforge (glaforge@gmail...)
06 Jul 2008
Re: [groovy-user] Omit "new"? c0mrade (jacksingleton1@gmail...)
06 Jul 2008
Re: [groovy-user] Omit "new"? Russel Winder (russel.winder@concertant...)
07 Jul 2008
Re: [groovy-user] Omit "new"? Guillaume Laforge (glaforge@gmail...)
07 Jul 2008
Re: [groovy-user] Omit "new"? Francesco Pasqualini (frapas@gmail...)
06 Jul 2008
Re: [groovy-user] Omit "new"? c0mrade (jacksingleton1@gmail...)
06 Jul 2008
Re: [groovy-user] Omit "new"? Guillaume Laforge (glaforge@gmail...)
07 Jul 2008
Re: [groovy-user] Omit "new"? Francesco Pasqualini (frapas@gmail...)
07 Jul 2008
Re: [groovy-user] Omit "new"? Francesco Pasqualini (frapas@gmail...)
07 Jul 2008
Re: [groovy-user] Omit "new"? Tom Nichols (tmnichols@gmail...)
07 Jul 2008
Re: [groovy-user] Omit "new"? Alexandru Popescu ☀ (the.mindstorm.mailinglist@gmail...)
07 Jul 2008
Re: [groovy-user] Omit "new"? Guillaume Laforge (glaforge@gmail...)
07 Jul 2008
Re: [groovy-user] Omit "new"? Francesco Pasqualini (frapas@gmail...)
07 Jul 2008
Re: [groovy-user] Omit "new"? Paul King (paulk@asert.com...)
07 Jul 2008
Re: [groovy-user] Omit "new"? Francesco Pasqualini (frapas@gmail...)
07 Jul 2008
Re: [groovy-user] Omit "new"? Alexandru Popescu ☀ (the.mindstorm.mailinglist@gmail...)
07 Jul 2008
Re: [groovy-user] Omit "new"? Graeme Rocher (graeme@g2one...)
07 Jul 2008
Re: [groovy-user] Omit "new"? Alexandru Popescu ☀ (the.mindstorm.mailinglist@gmail...)
07 Jul 2008
Re: [groovy-user] Omit "new"? Alexandru Popescu ☀ (the.mindstorm.mailinglist@gmail...)
07 Jul 2008
Re: [groovy-user] Omit "new"? Francesco Pasqualini (frapas@gmail...)
06 Jul 2008
Re: [groovy-user] Omit "new"? Alexander Veit (alexander.veit@gmx...)
06 Jul 2008
Re: [groovy-user] Omit "new"? Francesco Pasqualini (frapas@gmail...)
06 Jul 2008
Re: [groovy-user] Omit "new"? Tom Nichols (tmnichols@gmail...)
07 Jul 2008
Re: [groovy-user] Omit "new"? Charles Oliver Nutter (charles.nutter@sun...)
20 Jul 2008
RE: [groovy-user] Omit "new"? Eric Kolotyluk (eric.kolotyluk@kodak...)
07 Jul 2008
Re: [groovy-user] Omit "new"? Francesco Pasqualini (frapas@gmail...)
08 Jul 2008
RE: [groovy-user] Omit "new"? Detering Dirk (Dirk.Detering@bitmarck...)
08 Jul 2008
Re: [groovy-user] Omit "new"? Francesco Pasqualini (frapas@gmail...)
08 Jul 2008
RE: [groovy-user] Omit "new"? Detering Dirk (Dirk.Detering@bitmarck...)
08 Jul 2008
Re: [groovy-user] Omit "new"? Francesco Pasqualini (frapas@gmail...)
08 Jul 2008
Re: [groovy-user] Omit "new"? Francesco Pasqualini (frapas@gmail...)
08 Jul 2008
RE: [groovy-user] Omit "new"? Detering Dirk (Dirk.Detering@bitmarck...)
09 Jul 2008
RE: [groovy-user] Omit "new"? Eric Kolotyluk (eric.kolotyluk@kodak...)
08 Jul 2008
Re: [groovy-user] Omit "new"? Mark Davidson (ukdavo@googlemail...)
07 Jul 2008
Re: [groovy-user] Omit "new"? Guillaume Laforge (glaforge@gmail...)
07 Jul 2008
Re: [groovy-user] Omit "new"? c0mrade (jacksingleton1@gmail...)
07 Jul 2008
Re: [groovy-user] Omit "new"? c0mrade (jacksingleton1@gmail...)
07 Jul 2008
RE: [groovy-user] Omit "new"? Detering Dirk (Dirk.Detering@bitmarck...)
08 Jul 2008
RE: [groovy-user] Omit "new"? c0mrade (jacksingleton1@gmail...)
08 Jul 2008
Re: [groovy-user] Omit "new"? Guillaume Laforge (glaforge@gmail...)
08 Jul 2008
Re: [groovy-user] Omit "new"? c0mrade (jacksingleton1@gmail...)
08 Jul 2008
Re: [groovy-user] Omit "new"? Guillaume Laforge (glaforge@gmail...)
08 Jul 2008
Re: [groovy-user] Omit "new"? Guillaume Laforge (glaforge@gmail...)
08 Jul 2008
RE: [groovy-user] Omit "new"? Alexander Veit (alexander.veit@gmx...)
08 Jul 2008
Re: [groovy-user] Omit "new"? Tom Nichols (tmnichols@gmail...)
08 Jul 2008
RE: [groovy-user] Omit "new"? Alexander Veit (alexander.veit@gmx...)
08 Jul 2008
RE: [groovy-user] Omit "new"? Eric Kolotyluk (eric.kolotyluk@kodak...)
08 Jul 2008
Re: [groovy-user] Omit "new"? Alexandru Popescu ☀ (the.mindstorm.mailinglist@gmail...)
08 Jul 2008
Copyright 2006-2008 The Codehaus Foundation
Powered by Codehaus March (Version: 0.1-HEAD)