,optimize in Guile REPL produces invalid Scheme

Sin respuestas
Maxime Devos
Desconectado/a
se unió: 01/15/2017

Hi everyone,

When coding in a REPL in GNU Guile 2.0.9, the `,optimize` command
produces invalid Scheme code:

> m-m@m-pc:~$ guile-2.0
> scheme@(guile-user)> ,optimize ((lambda (x) (x x)) (lambda (x) (x x)))
> $1 = (let x ((x x)) (x x))

(The entered code (with the lambdas) goes in an infinite loop when
entered as-is, as it should.)

In the generated named let construct, the name of the iteration
procedure is the same as the name of the argument, resulting in a
failure of the named let to compile. Also, the iteration procedure
variable would not be bound in the argument list.

Testing the (invalid) generated code:

> scheme@(guile-user)> (let x ((x x)) (x x))
> While compiling expression:
> ERROR: Syntax error:
> unknown file:1:0: let: duplicate bound variable in form (let x ((x x))
> (x x))

Valid output of `,optimize` can be:
- `(let i () (i))`
- `((lambda (x) (x x)) (lambda (x) (x x)))`
- other code that loops infinitely

I don't know if this list is the correct list for bug reports, but there
is no `trisquel-bug` on
. Please tell me if this
is the wrong list.

Maxime