Re: Initial comments & questions
Ken Dickey 21 Mar 2004 15:22 UTC
KenD Wrote>>
> > I would suggest SYNTAX-BIND, since binding is what it does, and picking a
> > new name for the current (internal) syntax-bind.
Andre van Tonder wrote:>
> At first glance, binding is indeed what it does, but there are two
> possible problems that I can see.
>
> First, in the monadic prior art, *bind* is already used for something more
> akin to the current internal *syntax-bind*, so using bind for do could
> cause confusion.
But in Scheme prior art [T, Slade, 1987] BIND is used for (dynamic) binding
forms. We speak of lexical BINDings.
> 1) Indeed use syntax-bind, only for sequential bindings a la let*:
>
> (syntax-bind ((x (syntax-return (1 2 3)))
> (y (syntax-reverse x))
> (z (syntax-reverse y)))
> (syntax-return z))
So SYNTAX-LET* would make sense for that usage! [Freeing up SYNTAX-BIND for
the syntax-do which does not DO].
> Second, in e.g. Haskell,
Hey, not to belabor this too much, but *this is Scheme*.
Plugging in Haskell names confuses _me_!
One of your comments is that one does not have to know of Monads to use the
proposed system,
The First Rule of User Interface is that things which have similar effect
should look similar and things that are different should look different.
Your proposed forms should accord with Scheme forms in common use. Anything
else is confusing by design.
Designing for clarity is designing for the context of your (desired) users.
(You are not designing for Haskell users, are you? ;^)
> 2) Perhaps in future have syntax-begin for imperative
> things like syntax-debug-message. The above syntax-do example becomes
>
> (syntax-bind ((x (.......)))
> (syntax-begin
> (syntax-debug-message "Intermediate result = " x)
> (syntax-bind ((y (.....)))
> (syntax-if (syntax-atom? x)
> (syntax-begin
> (syntax-warning "Atoms may explode if split")
> (syntax-begin (y (......))
> (syntax-begin (syntax-debug-message "y = " y)
> (syntax-bind (z (.......))
> .
> .
>
> This is arguably more Schemely, but it is a royal pain to
> add debug messages this way....
I think you are making the argument for a declarative debug form here. I
support the notion.
Did you like SYNTAX-QUOTE ?
Cheers,
-KenD