Tobias C. Rittweiler | 31 May 16:17 2008
Picon

Re: Review cycle 1: binding constructs

"Nikodemus Siivola" <nikodemus <at> random-state.net> writes:

> On Sat, May 31, 2008 at 4:03 PM, Tobias C. Rittweiler <tcr <at> freebits.de> wrote:
>
> > I'd suggest to throw them away, and implement something like Erik
> > Naggum's WHEREAS outside of Alexandria instead.
>
> Can you explain you reasoning?

The reasoning is as following:

 a) The macros should short-circuit because if they don't, they're just
 sugaring over something that can be written directly without much
 effort or loss of aesthetics (YMMV.)

 b) If they short-circuit, Naggum's WHEREAS is the technical superior
 solution, as it'll also cover MULTIPLE-VALUE-BIND, for instance.

> >  (when-let ((foo  (frob1))
> >             (bar  (frob2))
> >             (quux (frob3))
> >   ..body..)
>
> Do you have a use case from real code?

Not really, because in real code, matters are more complicated warranting
a more complex macro. Hence my pledge for removal.

Do you have a use case for the non short-circuiting behaviour? 

(Continue reading)

Nikodemus Siivola | 31 May 16:37 2008
Picon

Re: Re: Review cycle 1: binding constructs

On Sat, May 31, 2008 at 5:17 PM, Tobias C. Rittweiler <tcr <at> freebits.de> wrote:

> Not really, because in real code, matters are more complicated warranting
> a more complex macro. Hence my pledge for removal.
>
> Do you have a use case for the non short-circuiting behaviour?

I don't have a _personal_ use-case for * variants at all. My own code
use only the unstarred versions.

My most common use-case is

 (when-let (x (foo))
    (frob x))

replacing

 (awhen (foo)
   (frob it))

.

Cheers,

 -- Nikodemus
Nikodemus Siivola | 1 Jun 00:09 2008
Picon

Re: Re: Review cycle 1: binding constructs

I've come around.

WHEN-LET* should indeed short-circuit. Because the semantics for
IF-LET* are less clear (re. the second leg), I think it should be
dropped. Has anyone ever actually needed IF-LET*? I originally added
mostly for symmetry.

Cheers,

 -- Nikodemus
Nikodemus Siivola | 1 Jun 00:29 2008
Picon

Re: Re: Review cycle 1: binding constructs

On Sun, Jun 1, 2008 at 1:09 AM, Nikodemus Siivola
<nikodemus <at> random-state.net> wrote:
> I've come around.

Patch attached.

 * Delete IF-LET*.

 * Make WHEN-LET* short-circuit, and adjust documentation to suit.

 * Test-case.

Unless there are objections, I'll push this soonish.

Cheers,

 -- Nikodemus
Attachment (when-let-star.diff): application/octet-stream, 5616 bytes
_______________________________________________
alexandria-devel mailing list
alexandria-devel <at> common-lisp.net
http://common-lisp.net/cgi-bin/mailman/listinfo/alexandria-devel

Gmane