[plt-scheme] top-level bindings vs. module imports

From: Doug Orleans (dougo at place.org)
Date: Tue Jun 15 18:16:28 EDT 2004

Doug Orleans writes:
 > This seems odd to me:
 > 
 > > (define (car) (car))
 > > (car)
 > car: expects 1 argument, given 0
 > 
 > I would expect it to loop.  I think I know what's going on: the
 > identifier `car' is module-imported, so it gets expanded to itself
 > instead of to `(#%top . car)' in the new procedure body.  Is this a
 > bug?

I forgot to mention, I'm using a language that re-exports bindings
from mzscheme.  This doesn't happen if you start in mzscheme.  Here's
a full transcript:

  Welcome to MzScheme version 207.1, Copyright (c) 2004 PLT Scheme, Inc.
  > (define (car) car)
  > (eq? car (car))
  #t
  > (module foo mzscheme (provide (all-from mzscheme)))
  > (require foo)
  > (define (cdr) cdr)
  > (eq? cdr (cdr))
  #f

--dougo at place.org


Posted on the users mailing list.