Re: [Sbcl-devel] [Sbcl-commits] master: Handle environment initialization better.

4 views
Skip to first unread message

Nikodemus Siivola

unread,
Apr 29, 2013, 2:41:06 PM4/29/13
to sbcl-devel
On 29 April 2013 20:23, stassats <stas...@users.sourceforge.net> wrote:

Much kudos for this patch! One thing struck my eye, though:

> +(defmacro init-var-ignoring-errors (variable
> + form
> + &key default
> + explanation
> + (condition 'error))
> + `(handler-case
> + (setf ,variable ,form)
> + (,condition (c)
> + (let ((default ,default))
> + (warn "Error initializing ~a~@[ ~a~]:~@
> + ~a
> + ~% Using ~s instead."
> + ',variable
> + ,explanation
> + c
> + default)
> + default))))

Should this not be

`(setf ,variable (handler-case ...))

? Now if there's an error variable won't be set at all.

Cheers,

-- nikodemus

------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr
_______________________________________________
Sbcl-devel mailing list
Sbcl-...@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sbcl-devel

Stas Boukarev

unread,
Apr 29, 2013, 3:31:02 PM4/29/13
to Nikodemus Siivola, sbcl-devel
Nikodemus Siivola <niko...@random-state.net> writes:

> On 29 April 2013 20:23, stassats <stas...@users.sourceforge.net> wrote:
>
> Much kudos for this patch! One thing struck my eye, though:
>
>> +(defmacro init-var-ignoring-errors (variable
>> + form
>> + &key default
>> + explanation
>> + (condition 'error))
>> + `(handler-case
>> + (setf ,variable ,form)
>> + (,condition (c)
>> + (let ((default ,default))
>> + (warn "Error initializing ~a~@[ ~a~]:~@
>> + ~a
>> + ~% Using ~s instead."
>> + ',variable
>> + ,explanation
>> + c
>> + default)
>> + default))))
>
> Should this not be
>
> `(setf ,variable (handler-case ...))
>
> ? Now if there's an error variable won't be set at all.
Right, of course. Thanks for the catch.
--
With best regards, Stas.
Reply all
Reply to author
Forward
0 new messages