I do not know much about OO-languages, but from what I have seen, it seems most class-based OO-languages uses a keyword new (or something equivalent) to create an object. Prototype-based OO-languages like JavaScript even fake it.
From a viewpoint of keeping the syntax simple, why not leave out the new keyword and use only the constructor (typically of the same name as the class)?
Is there any semantic consideration involved in prefixing the constructor with a new keyword?
I have noticed that in Scala, if you define a case-class, you can simply use the constructor without a preceding new to create an object, while for other classes, you have to use new. I do not know the reason. I mention it simply because it may be related.
List()is it creating a list, or is it listing something (noun or verb)? If I writenew List()the ambiguity goes away. – Hey Jan 03 '15 at 10:27this, couldn't you? I think "new distinguishes object creation from method invocation" is exactly the point, though... not necessarily just for the compiler/interpreter, but also for the developer. – Hey Jan 03 '15 at 11:53List()is a terrible name for a method. – DeadMG Jan 03 '15 at 12:16newunless I name it likecreateFoo. Just two different ways of looking at the same problem I guess. – Hey Jan 03 '15 at 13:14