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, AFAIK, and
"calling" a class can hardly have any other sense. Maybe classes' opCall could be set to
the creation routine (whatever new calls); then we would get a single object-creation syntax.
This is no request :-) I just ask to try& understand the rationale behind
"new".
As far as I can make out, though likely I am wrong, there is no need for
"new" in a "pure" garbage-collected language, that is, wherein there is
no corresponding "delete".
Perhaps "new" in a "by-default-GC-collected-PL" should signal that the
newly allocated object is not subject to automatic GC and that a
corresponding "delete" should ensure to (1) avoid miscapture by GC and
(2) to provide backward compatibility for C++ semantics.
To use dotNet parlance, perhaps "new" and "delete" should only apply in
the context of "unmanged objects".
Really I don't know enough about the subject to make a call on this,
though I suspect if you push the point enough there will be a torrent of
discussion and opposing views on the subject.
I do agree though that this topic deserves a first-class discussion.
Best wishes,
Justin Johansson