smart exceptions

Thomas Lindgren thomasl_erlang@REDACTED
Tue Mar 7 17:27:31 CET 2006



--- Serge Aleynikov <serge@REDACTED> wrote:

> Thomas, thanks for your tips.
> 
> Another question: In the attached example when an
> undefined function is 
> called (test case 0) the line number doesn't get
> written as you can see 
> below.  Is this expected?

Yes. There are some cases that can't be (cheaply)
caught by smart_exceptions. At compile-time, we don't
know if the function is supposed to be defined or not,
and wrapping a catch around every function call to
handle if it's undefined seems like overkill.

You will see the same thing when calling bad funs, I
believe. And calling code that wasn't compiler with
smart exceptions will throw dumb old exceptions. 

All of these appear because this sort of checking
seemed too expensive.

Oh yes, there is another case where you will get dumb
exceptions: when a binary expression fails (e.g., A =
{foo}, <<A:32>>). This one is something that should be
fixed, but I've put it off.

Finally, there is a fundamental weakness:
smart_exceptions do not handle expressions with
exported variables well. This is a thorny issue, but
if erlc reports that variables are mysteriously
undefined, that may be the cause.

(And as you can see, smart exceptions is really
functionality that sits better integrated in the VM
:-)

If you have any usage/features feedback, send me a
mail.

Best,
Thomas


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the erlang-questions mailing list