chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-users] Modules and environments


From: Peter Bex
Subject: [Chicken-users] Modules and environments
Date: Sun, 30 Aug 2009 15:11:23 +0200
User-agent: Mutt/1.4.2.3i

Hi all,

I've observed a strange thing with Chicken's modules:

(module test
  (hello)
(import chicken scheme)
(define (hello) (print "hello"))
)
(import test)

(use environments)
(print (environment-has-binding? (interaction-environment) 'hello))

This prints #f, whereas I would have expected it to print #t, since
defining a module and importing should be identical to putting the
module's body in the file. So, this should be identical to the code:

(use environments)
(define (hello) (print "hello"))
(print (environment-has-binding? (interaction-environment) 'hello))

What's wrong here?

By the way,
(print (environment-has-binding? (interaction-environment) 'test#hello))
shows #t, but it does this even without the import.

Cheers,
Peter
-- 
http://sjamaan.ath.cx
--
"The process of preparing programs for a digital computer
 is especially attractive, not only because it can be economically
 and scientifically rewarding, but also because it can be an aesthetic
 experience much like composing poetry or music."
                                                        -- Donald Knuth

Attachment: pgpi1G0IXvAKD.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]