smart exceptions
Serge Aleynikov
serge@REDACTED
Thu Mar 23 16:21:13 CET 2006
Thomas,
I believe this might be a bug in the parse_transform causing a compiler
warning in cases like the one attached.
$ erlc -W +'{parse_transform, smart_exceptions}' t.erl
./t.erl:12: variable 'Result' unsafe in 'case' (line 6)
$ erlc -W t.erl
[no warnings]
Serge
Thomas Lindgren wrote:
>
> --- 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
>
--
Serge Aleynikov
R&D Telecom, IDT Corp.
Tel: (973) 438-3436
Fax: (973) 438-1464
serge@REDACTED
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: t.erl
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20060323/228f1fb4/attachment.ksh>
More information about the erlang-questions
mailing list