[Top][All Lists]

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

Re: [Chicken-users] Advice on require, use, import, etc.

From: Jim Ursetto
Subject: Re: [Chicken-users] Advice on require, use, import, etc.
Date: Thu, 13 Aug 2009 22:58:43 -0500

On Sun, Aug 9, 2009 at 11:52 AM, Sam Varner<address@hidden> wrote:
>     1. Should I prefer 'import' if it's available?  E.g (import srfi-4)
>        instead of (use srfi-4).

It's actually (require-library srfi-4) (import srfi-4) == (use
srfi-4).  The code load and module import are separate steps.


$ csi -no-init
#;1> (module foo () (import scheme) (import srfi-4) u8vector)
; loading /Users/jim/local/chicken-4/lib/chicken/4/ ...
; loading /Users/jim/local/chicken-4/lib/chicken/4/ ...
Error: unbound variable: u8vector

$ csi -no-init
#;1> (module foo () (import scheme) (require-library srfi-4) (import
srfi-4) u8vector)
; loading /Users/jim/local/chicken-4/lib/chicken/4/ ...
; loading /Users/jim/local/chicken-4/lib/chicken/4/ ...
; loading library srfi-4 ...
#<procedure (u8vector . xs966)>

If you do not need to use import specifiers such as 'rename' or
'only', you may condense the two steps into one using (use srfi-4) or
(require-extension srfi-4).  Otherwise, you must perform both steps.


reply via email to

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