On Friday, October 25, 2002, at 09:56 PM, Lars Jensen wrote:
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.
Ah, maybe while I was on vacation...thanks for the repeat. Otherwise I
would
have been adding nil checks to all my code...which is a good argument
for
having it be the way it is...
Actually, the fact that New cannot return Nil took many of us by
surprise. And as you pointed out, it's contrary to what's in the
documentation. Had Joe Strout not mentioned it while working on the
Offworld project, I wouldn't have known either.
You should keep in mind though that some specialized functions such as
NewPicture can return Nil if they're programmed to do so. It's just the
generic New operator that cannot.
If I had my way, New would still not return Nil, but would throw an
OutOfMemoryException, so I could trap it and handle it as I see fit.
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>
.
|