[plt-scheme] V4 request for thoughts on various question

From: Eli Barzilay (eli at barzilay.org)
Date: Sun Aug 3 16:59:49 EDT 2008

On Aug  3, Grant Rettke wrote:
> Hi folks,
> While reading the V4 guide (not detailed reference, yet) I noted some
> questions, and wondered what other folks had to say about them:
> When do you use weak hash tables?

A classic case for weak hash tables is when you want to associate
arbitrary data with values -- you use a hash table, but you don't want
it to prevent collecting garbage.

> When might folks use case-lambda rather than keyword or optional
> arguments?

Two points: optionals are a little slower currently, and there are
things that you cannot do with them, for example:

  (define draw-foo
    (case-lambda [(foo) (draw-foo foo 0 0)]
                 [(foo x y) ...]))

But Noel's point is good too -- think of it as a more primitive tool.

> Does anyone use the curried define form?

Yes.  Very convenient in some cases.

> Do folks use values and define-values much, or destructure and use
> lists, match-define or match-let instead?


> The fact that let allow paralell bindings, do some folks take that
> fact and perform optimizations on multiple cpu boxes? Is it worth
> it?

The values are parallel, but the computation is not.  It's easy to
confuse the two, but it's a mistake.

> How would you use letrec-values?

Very rare uses for it.  Another mostly-for-primitive-use thing.

> I don't use structures much, but they seem pretty versatile and
> therefore important; are they?


> Structure guards are neat. Where does this fit in dynamic world? You
> could make a type change and detect it in a running system.  Is
> typing the data enough, is that the perfect mix between static and
> dynamic languages?

Same idea as contracts.

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

Posted on the users mailing list.