[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Public WebGL] Null return values on context loss



On Wed, Nov 16, 2011 at 05:11, Glenn Maynard <glenn@zewt.org> wrote:
>>> I'm not sure what the right thing to do would be, though. Throwing an
>>> exception would be an improvement, at least.
>>
>> No that would be just as a bad if not worse.
>
> I think it's a straightforward improvement, for the cases where returning
> null breaks code. It doesn't make code work automatically, but it makes
> writing correct code a lot less painful, in the usual sense of being able to
> put error checking in an exception handler instead of sprinkling null checks
> all over the place.

Hmm, for this particular case, isn't this just trading an exception
for another afaics?
If you prefer not to have null checks, you could catch the null
reference exception (ie. TypeError).

Regards,

-----------------------------------------------------------
You are currently subscribed to public_webgl@khronos.org.
To unsubscribe, send an email to majordomo@khronos.org with
the following command in the body of your email:
unsubscribe public_webgl
-----------------------------------------------------------