[racket-dev] Falling through cond clauses

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Tue Oct 2 10:43:33 EDT 2012

On Tue, Oct 2, 2012 at 9:39 AM, Carl Eastlund <cce at ccs.neu.edu> wrote:
> I'm not surprised, I pretty much expected this response, but I'm curious
> what the difficulty was.  Is cond-as-void relied on that much more
> pervasively than mutable pairs?

I'm not sure I can comment on the relative reliance, but in the case
of mutable pairs, we had a lot at stack (ie many abstractions are
broken in their presence). That's not the case with the cond/void
situation.

> Is it exceedingly hard to add else-clauses
> to all the necessary conds?  You two, Robby and Matthew, probably have a
> better idea than I do about the prevailing trends in the Racket code base.

I don't think we considered writing a script to stick else clauses in.
We just were surprised at how often it was relied on and decided to
give up. (But memory is a fragile thing, so I could be getting this
completely wrong.)

Robby

> Carl Eastlund
>
>
> On Tue, Oct 2, 2012 at 10:36 AM, Robby Findler <robby at eecs.northwestern.edu>
> wrote:
>>
>> IIRC, we even experimented with this one briefly and quickly gave up
>> as we got overwhelmed.
>>
>> Robby
>>
>> On Tue, Oct 2, 2012 at 9:22 AM, Matthew Flatt <mflatt at cs.utah.edu> wrote:
>> > I think this a great change for a future `racket2' (someone should be
>> > keeping a list of these), but it's too incompatible a change for `cond'
>> > in `racket'.
>> >
>> > At Tue, 2 Oct 2012 09:52:38 -0400, Carl Eastlund wrote:
>> >> I often wish cond would raise an exception if all the tests failed and
>> >> there were no else clause.  I have taken to writing a macro to enforce
>> >> this; I usually call it cond!.  The void default for cond seems like an
>> >> un-Racketish holdover from primarily-imperative programming.  With some
>> >> of
>> >> the other changes we've made in Racket, are we willing to consider
>> >> changing
>> >> the fall-through behavior of cond?  It seems like an experiment worth
>> >> running to me.
>> >>
>> >> If not, I would at least like to add an erroring version of cond
>> >> somewhere
>> >> in the language.  It's a shame to have to keep writing such a primitive
>> >> feature.  Right now in my dracula github repo I have cond! implemented
>> >> in
>> >> racket/cond and re-exported from racket, but I'm not thrilled about
>> >> either
>> >> the location or the name.  I kept it out of racket/base so I could
>> >> depend
>> >> on the syntax collection for good source location reporting in the
>> >> error
>> >> message.
>> >>
>> >> Carl Eastlund
>> >> _________________________
>> >>   Racket Developers list:
>> >>   http://lists.racket-lang.org/dev
>> > _________________________
>> >   Racket Developers list:
>> >   http://lists.racket-lang.org/dev
>>
>

Posted on the dev mailing list.