[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: error, setjmp and exceptions
- From: Roberto Ierusalimschy <roberto@...>
- Date: Thu, 18 Dec 2003 16:53:00 -0200
> 1. Are there any common platforms that would have hard time with
> setjmp/longjmp C functions and thus with Lua error function in
> general. How about game consoles? PDAs?
Both seem like simple operations in a stack architecture. But almost
any operation can be too slow in a specific machine.
> 2. Does calling 'error' impair garbage collection in any way? That is,
> if I had some user data referenced in a function that calls error would
> such user data be collected properly?
No and yes.
> 3. If you have used 'error' for exceptions, what are you
> impressions? What worked, what didn't?
One problem is that you must differentiate between exceptions and
"real" errors. Another is that the "try" clause must be a function
call. You can (should?) use anonymous functions for that, but then each
"try" creates a new function. This is not too bad, but it causes some
overhead. It is cheaper to use a fixed function for that, but the code
may not look so clean.
-- Roberto