Am Mi., 7. Sept. 2022 um 18:12 Uhr schrieb Marc Nieper-Wißkirchen <
[email protected]>:

> Am Mi., 7. Sept. 2022 um 16:36 Uhr schrieb John Cowan <[email protected]>:
>
>
>
>>
>>    Why is `with-continuation-mark` a syntax, not a procedure accepting a
>>>> thunk?
>>>>
>>>
>>> Partly because of history.  This comes from Racket.
>>>
>>
>> I think we should consider changing that.  Racket has little respect for
>> backward compatibility: why should we, especially if it provokes
>> confusion?
>>
>
> Just because Racket seemingly has little respect is no good reason IMHO.
>
> In fact, w-c-m is much older than the current day Racket, which has been
> diverging from Scheme.  The idea of continuation marks goes back to the
> paper "Modeling an Algebraic Stepper" by Clements/Flatt/Felleisen from 2001
> and the name and syntax of w-c-m already appear there.
>
> In general a procedure provides more flexibility, syntax more convenience,
>> but it's easy to layer syntax over a procedure.  CL uses the `with-*`
>> naming convention for syntax, but in Scheme it's almost always a procedure
>> that takes a thunk, though in this case the thunk is often the last
>> argument rather than the first.  "A foolish consistency is the hobgoblin of
>> little minds", but there is also consistency which is not foolish.
>>
>
> It is also easy to layer a procedure over syntax but syntax makes it
> easier for compilers (because there is one less indirection and syntax is
> always inlined, which may not happen with procedures imported from
> pre-compiled libraries).
>
> The prefix `with-` does not seem to be used consistently in Scheme.  For
> example, there is `with-syntax` in R6RS, which is a binding construct for
> pattern variables.  My own SRFI 210 has `with-values`, which can be tracked
> down to a paper by Kent Dybvig (that paper also makes a point about why
> syntax is sometimes preferable; `with-values` is actually the syntactic
> version of `call-with-values`).
>
> In any case, I don't see a convincing argument for breaking compatibility
> with a form that has been around for more than 20 years in exactly the same
> situation.  I agree that there is some irregularity, but this irregularity
> pervades the whole Scheme language.  Your SRFI 235 shows how a lot of
> syntax could have specified as procedures, instead.
>

I added a reference to the Clements/Felleisen/Flatt paper and some rational
for why w-c-m is a special form.

Reply via email to