Re: 251 vs. 245 Daphne Preston-Kendal 04 Dec 2023 10:24 UTC

On 4 Dec 2023, at 10:50, Vladimir Nikishkin <xxxxxx@gmail.com> wrote:

> In fact, while the benefit of running some type checks and debugging
> printing at the beginning of the function is unquestionable, I am not
> even sure that letrec* is the correct model for the following
> definitions. Maybe lectrec (without a *) would be a better choice.

letrec is simply letrec* with no guarantee on the left-to-right evaluation and binding order. It enables nothing and forbids only cases such as

(letrec* ((f (lambda (n) … some recursive function …))
          (a (f x)))
  … some body …)

because ‘a’ uses the value of ‘f’ in its init clause — allowed by letrec*, disallowed by letrec. Concretely this would (once again) forbid

(define (my-proc x)
  (define (f n) … recursive function as above …)
  (define a (f x))
  … body as above …)

which is allowed in R6RS and R7RS small; it was not allowed in R5RS and earlier, because letrec* had not been invented yet.

> Yeah, don't write code this badly, but "don't do something" is a bad
> advice in programming.

If you want Pascal, you know where to find it. /snark

Scheme does not subscribe to this philosophy. We are definitively not in the business of preventing bad programming by restricting *all* programmers’ access to powerful primitives and abstractions.

Daphne