Hi Jędrek.

> (C)
>        if (exception) {
>         if (exec->hadException()) {
>             *exception = toRef(exec, exec->exception());
>             exec->clearException();
>         } else
>             *exception = 0;
>     } else
>         exec->clearException();
> In this case exception handler is always set correctly. Would it make sense 
> to change the behavior?

As you said, this suggestion is slightly less efficient than the current 
behavior.

As Darin said, this change might lead to incorrect behavior if a developer 
tested against the newest JavaScriptCore but deployed on systems with older 
JavaScriptCores.

Another downside to this change is that a programmer who called two API 
functions in a row, forgetting to check for an exception between them, will not 
see the exception at all, since the second call will reset the exception value 
to 0.

I'm not sure that these three downsides are overwhelming. But what's the upside 
to weigh against them? It's slightly inconvenient to initialize the exception 
value to 0, but, assuming no exception is thrown, a programmer only has to do 
that once per block of code:

JSValueRef exception = 0;
a(..., &exception);
b(..., &exception);
c(..., &exception);

Do you have a use case where you end up initializing the exception value over 
and over again?

Or is your goal to save programmers who forget to initialize exception to 0?

Geoff
_______________________________________________
squirrelfish-dev mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/squirrelfish-dev

Reply via email to