[racket-dev] exact nonnegative integers as sequences?

From: Eli Barzilay (eli at barzilay.org)
Date: Mon Apr 18 11:09:52 EDT 2011

Three minutes ago, Robby Findler wrote:
> On Mon, Apr 18, 2011 at 9:59 AM, Eli Barzilay <eli at barzilay.org> wrote:
> > 9 minutes ago, Matthew Flatt wrote:
> >> Thanks for the clarifications, and I now agree that it's not about
> >> genericity.
> >>
> >> I think it's about scripts to programs, though. In a script, not
> >> having to type `(in-range ....)' or `(in-list ....)' feels
> >> worthwhile. You make a good point that those scriptish shortcuts can
> >> make understanding the code a little harder, and using `in-range' or
> >> `in-list' can good for long-term maintenance. Still, I think it's
> >> better to allow the shortcuts.
> >
> > Is there any difference between this and other generic operations
> > (which could also benefit from types being more explicit and more
> > checked)?
> >
> > [Not intended as a flame -- I'm curious to see if there's something
> > makes some generics be worse than others.]
> 
> As you probably guessed, I think that this is more of a
> coherent-language-design issue, but I bet someone could conduct some
> kind of a survey type thing to figure out what leads to more bugs or
> what programmers find confusing or something along those lines (ie,
> you decide on some concrete measure for "worse" and then conduct a
> study to try to answer that question).

:)  My own use of the for loops is usually without using the generic
dispatch thing, similar to regexp functions.  I get the feeling that
you'd similarly want those to throw errors on strings and require an
explicit `regexp' if you really want to use a string -- but there the
reason is clearer: you have (regexp-match "foo" "bar") and it's easy
to mix the two -- so to avoid relying on my memory, I'd just use
(regexp-match "foo" #rx"bar") and let racket barf at me when I need
to change the order.  (And even TR won't save me there.)

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!


Posted on the dev mailing list.