|
Which, in Dylan, would probably be transliterated as something
like
let (bindings) body ... end
given the rest of the syntax.)
I have to admit that this bothered me, too, at first. Until I started
using it. All of a sudden, I discovered the joy of not needing a
new level of indentation just to introduce a new local variable.
(C++ programmers probably feel the same way: C requires that
local declarations appear at the beginning of a {} enclosed block,
where C++ allows them in any statement position. Very
convenient.)
But, if you really don't like that bit of Dylan syntax after trying it,
here's a ``bind'' macro which behaves like a Lisp/Scheme let*.
The word ``let'' is one of the eight or so truly reserved words in
Dylan that can't be renamed, so I had to use a different name.
define macro bind
{ bind (?bindings) ?:body end }
=> { ?bindings; ?body }
bindings:
{ ?binding:*, ... }
=> { let ?binding; ... }
{ }
=> { }
end macro;
So, for example,
bind (a = 1, b = 2)
a + b
end
=> 3
bind (a = 1, b = a + 1)
b
end
=> 2
bind (a = 13, a = 42)
a
end
=> 42
|