realbasic-betas.mbox
[Top] [All Lists]

Re: new <> nil (was: Re: new folderItem)

To: REALbasic Betas <realbasic-betas at lists dot realsoftware dot com>
Subject: Re: new <> nil (was: Re: new folderItem)
From: Robert Steely <robsteely at nc dot rr dot com>
Date: Fri, 25 Oct 2002 20:46:38 -0400
On Friday, October 25, 2002, at 08:09  PM, Lars Jensen wrote:

Wait a sec...from the 4.5 Language Reference, p.311:

"When you try to create an object with the New operator, the application may
not have enough memory to actually create the object. If so, the 'new'
object will actually be Nil. Before proceeding, it is best to test for a Nil
object before proceeding."

Think-aloud: So new _can_ return nil sometimes. My question remains: should
it do so if it's invoking a copy constructor with a nil argument?

We had a huge discussion about this a few months back. The "New" operator is physically incapable of returning nil. It cannot do so under any circumstances. The developer's guide and the language reference are both wrong and need to be corrected.

If "New" fails to return a valid object, your RB-built application posts a dialog stating that you ran out of memory and the program quits. Not very elegant, but that's how it's been for a very, very long time.

Bob


---
A searchable archive of this list is available at:
<http://dbserver.realsoftware.com/KBDB/search.php>

Unsubscribe:
<mailto:realbasic-betas-off at lists dot realsoftware dot com>

Subscribe to the digest:
<mailto:realbasic-betas-digest at lists dot realsoftware dot com>
.


<Prev in Thread] Current Thread [Next in Thread>