sperber(a)informatik.uni-tuebingen.de (Michael Sperber [Mr. Preprocessor]) writes:
> >>>>> "Clemens" == Clemens Heitzinger <cheitzin(a)rainbow.studorg.tuwien.ac.at> writes:
>
> Clemens> sperber(a)informatik.uni-tuebingen.de (Michael Sperber [Mr. Preprocessor]) writes:
>
> Clemens> On the other hand, I don't think that in Scheme you can say
> Clemens> you want this and that variable *not* to be hygienic.
> >>
> >> No, but (to quote Craig in this discussion :-}) why would you want
> >> this?
>
> Clemens> One example is LOOP-FINISH. From the HyperSpec:
>
> Clemens> ----------------------------------------------------------------------
> Clemens> The loop-finish macro can be used lexically within an extended loop
> Clemens> form to terminate that form normally. That is, it transfers control
> Clemens> to the loop epilogue of the lexically innermost extended loop form.
> Clemens> This permits execution of any finally clause (for effect) and the
> Clemens> return of any accumulated result.
>
> Clemens> Examples:
> Clemens> ;; Terminate the loop, but return the accumulated count.
> Clemens> (loop for i in '(1 2 3 stop-here 4 5 6)
> Clemens> when (symbolp i) do (loop-finish)
> Clemens> count i)
> Clemens> => 3
> Clemens> ----------------------------------------------------------------------
>
> Clemens> This is defined in the CL standard and I find it quite useful.
>
> Not that I claim to understand all the ramifications, but what makes
> this macro non-hygienic? You've posted a description, but no
> definition.
What definition do you want? Source code? You'll find it in the
source code of your favorite CL implementation. I guess you can also
find the source code of early implementations of the loop macro on the
net.
loop-finish is usually defined with macrolet and "pollutes" the name
space (i.e. makes it non-hygienic), which is useful in this case.
> But then of course, in Scheme idiomatics, you wouldn't even need a
> macro to define this kind of thing ...
Now you are talking about something completely different. The
question was not if you need a macro to do this or not, but to provide
an example where "polluting" the namespace is useful.
But while we are at it, how would you write the loop macro and
loop-finish in Scheme? This would really be interesting.
Yours,
--
Clemens Heitzinger
Student der Techn. Mathematik, Technische Universität Wien, Österreich
Vienna University of Technology, Austria