chicken-users
[Top][All Lists]
Advanced

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

[Chicken-users] bug in functor implementation


From: Juergen Lorenz
Subject: [Chicken-users] bug in functor implementation
Date: Wed, 13 Aug 2014 13:37:01 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

Hi all,

I've found a bug in the functor implementation.
Consider the following trivial example

;;; doubling-functor.scm
;;; --------------------

;;; compile-with csc -s doubling-functor.scm -J
;;;              csc -s doubling-functor.import.scm

;;; defining the functor
(functor (doubling-functor
           ;; parameter module with its exports
           (M (add)))
  ;; exports of doubling-functor
  (doubling)
  ;; body of doubling-functor
  (import scheme M)
  (define (doubling x) (add x x)))

;;; num-doubler.scm
;;; ---------------

(import doubling-functor)

;;; parameter module defining add
(module nums (add)
  (import scheme)
  (define (add x y) (+ x y)))

;; instantiating doubling-functor by applying it to concrete argument
;; modules

(module num-doubler = (doubling-functor nums))

;;;; or -- in short form
;(module num-doubler = doubling-functor
;  (import scheme)
;  (define (add x y) (+ x y)))

;;; end of file

Everything works fine in interpreted mode. Compiling doubling-functor.scm
works as well. But if you compile num-doubler
   
           csc -s num-doubler.scm -J
                 csc -s nums.import.scm
                 csc -s num-doubler.import.scm

the last call will fail. The reason is the line

     (eval '(import scheme M))

of the chicken generated file num-doubler.import.scm.
Of course, M should be replaced by nums (or _num-doubler in the short
form). After this change, compiling and using works well.

Cheers

Juergen

-- 

Dr. Juergen Lorenz
Flensburger Str. 12
10557 Berlin

Attachment: smime.p7s
Description: S/MIME cryptographic signature


reply via email to

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