[racket-dev] Falling through cond clauses

From: Carl Eastlund (cce at ccs.neu.edu)
Date: Tue Oct 2 10:18:31 EDT 2012

Let's not piggy-back too much on this one change.  First of all, I'm
proposing a very simple change, albeit with potentially complex
consequences; you've got a somewhat more complex design change in mind, but
entirely backwards compatible.  Second, you detect definitions by using
"define" as a keyword?  No, thank you, sir.  Let me know when you have a
design that allows arbitrary definitions.  Personally I think this concept
will work better as a new macro than an add-on for cond, because you're
turning the already-overloaded test position, which can be an expression or
a cond-specific keyword, into a triple-overload including definition
special form names.

Carl Eastlund

On Tue, Oct 2, 2012 at 10:11 AM, Jay McCarthy <jay.mccarthy at gmail.com>wrote:

> In addition to this, I want internal definitions in conds:
>
> (cond
>  [test1 body1]
>  (define var ...)
>  [(test2 var) body2]
>  [(test3 var) body3])
>
> I have a macro that does these things:
>
> https://github.com/jeapostrophe/exp/blob/master/condd.rkt
>
> It's pretty cute
>
> Jay
>
> On Tue, Oct 2, 2012 at 7:58 AM, Carl Eastlund <cce at ccs.neu.edu> wrote:
> > Oh, no, as far as a "does it work out of the box" experiment goes, it
> fails.
> > Racket doesn't even compile.  I meant more along the lines of our
> > immutable-cons experiment, where we fix a bunch of code and see how
> > problematic the compatibility issue becomes over time.
> >
> > Carl Eastlund
> >
> >
> > On Tue, Oct 2, 2012 at 9:56 AM, J. Ian Johnson <ianj at ccs.neu.edu> wrote:
> >>
> >> This experiment should be easy to run, no? Change the default cond and
> run
> >> DrDr?
> >> -Ian
> >> ----- Original Message -----
> >> From: "Carl Eastlund" <cce at ccs.neu.edu>
> >> To: "Racket Developers" <dev at racket-lang.org>
> >> Sent: Tuesday, October 2, 2012 9:52:38 AM GMT -05:00 US/Canada Eastern
> >> Subject: [racket-dev] Falling through cond clauses
> >>
> >>
> >> 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
> >
>
>
>
> --
> Jay McCarthy <jay at cs.byu.edu>
> Assistant Professor / Brigham Young University
> http://faculty.cs.byu.edu/~jay
>
> "The glory of God is Intelligence" - D&C 93
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/dev/archive/attachments/20121002/0fbe06c5/attachment.html>

Posted on the dev mailing list.