[plt-scheme] circular definitions

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Mon Jul 20 10:33:12 EDT 2009

On Jul 20, 2009, at 9:23 AM, Keiko Nakata wrote:

> Hello.
> What is the motivation to treat circular definitions differently
> between top-level definitions and local letrec's?
> I mean:
> ;This causes an error immediately.
> (define x0 x0)

One could argue that the following two are (unreported) errors due to  
an overly accommodating syntax. -- Matthias

p.s. Try this in HtDP/Intermediate:

(define x (local ((define x x)) x))

> ;This does not cause an error.
> (define x1 (letrec ([tmp tmp]) tmp))
> ;This does not cause an error too.
> (define-signature u^ (x2))
> (define-unit [email protected] (import) (export u^) (define x2 x2))
> (define-values/invoke-unit/infer [email protected])
> The third example particularly motivated me to think about why the
> different treatment is necessary/preferable in respect of the
> implementation and the language design.
> Best,
> Keiko
> _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme

Posted on the users mailing list.