[Chicken-users] cannot import from undefined module

2012-03-07 Thread Mark Carter
I'm trying to put some functions into a module, but I'm having 
difficulties. Everything seems to work when I use csi - putting it into a 
module causes errors. Here's the specific errors I am encountering:

Warning: reference to possibly unbound identifier `read-lines' in:
Warning:rep-read-file-lines

Warning: reference to possibly unbound identifier `call-with-input-
string' in:
Warning:rep-read-string

I think it has got something to do with the fact that the functions are 
visible in the namespace used by csi, but not when I create a module. 

If I try to import srfi-6 in my module, like so:

(module 
 mccsl ( define-simple-syntax)
 (import scheme chicken)
 (import srfi-6)
  ...
)

I get the compilation error
Syntax error (import): cannot import from undefined module

What do I do to fix this? It's all proving to be an uphill battle.

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] cannot import from undefined module

2012-03-07 Thread Christian Kellermann
Hi Mark,

* Mark Carter mcar...@markcarter.me.uk [120307 14:03]:
 If I try to import srfi-6 in my module, like so:
 
 (module 
  mccsl ( define-simple-syntax)
  (import scheme chicken)
  (import srfi-6)
   ...
 )
 
 I get the compilation error
 Syntax error (import): cannot import from undefined module
 
 What do I do to fix this? It's all proving to be an uphill battle.

There is no module called srfi-6. The list of available modules
that are included in chicken-core is described in the manual:
http://api.call-cc.org/doc/chicken/language all extensions have to
be installed with chicken-install and loaded with (use) or
(require-extension). A list of it is available http://wiki.call-cc.org/eggs
or searchable here: http://api.call-cc.org/doc/

string ports are available throught the ports unit:
http://api.call-cc.org/doc/ports

HTH,

Christian

-- 
Who can (make) the muddy water (clear)? Let it be still, and it will
gradually become clear. Who can secure the condition of rest? Let
movement go on, and the condition of rest will gradually arise.
 -- Lao Tse. 

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] cannot import from undefined module

2012-03-07 Thread Peter Bex
On Wed, Mar 07, 2012 at 01:03:41PM +, Mark Carter wrote:
 If I try to import srfi-6 in my module, like so:
 
 (module 
  mccsl ( define-simple-syntax)
  (import scheme chicken)
  (import srfi-6)
   ...
 )
 
 I get the compilation error
 Syntax error (import): cannot import from undefined module

That's because (import ...) only loads the import library.
Chicken is a compiler which uses separate compilation, which means we
also support cross-compilation. To get all this to work properly,
the import libraries are separated from the actual libraries.

The import library only contains macro stuff and information about
available symbols.

To load the library itself, you should use the USE clause:

(module mccsl (define-simple-syntax)
  (import chicken scheme)
  (use srfi-6)
  ...)

 What do I do to fix this? It's all proving to be an uphill battle.

We'd appreciate if you could provide hints about how to improve the
documentation.  This is often a problem for newbies, so we should really
try and fix this.

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

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] cannot import from undefined module

2012-03-07 Thread Christian Kellermann
* Christian Kellermann ck...@pestilenz.org [120307 14:10]:
 Hi Mark,
 
 * Mark Carter mcar...@markcarter.me.uk [120307 14:03]:
  If I try to import srfi-6 in my module, like so:
  
  (module 
   mccsl ( define-simple-syntax)
   (import scheme chicken)
   (import srfi-6)
...
  )
  
  I get the compilation error
  Syntax error (import): cannot import from undefined module
  
  What do I do to fix this? It's all proving to be an uphill battle.
 
 There is no module called srfi-6. The list of available modules
 that are included in chicken-core is described in the manual:
 http://api.call-cc.org/doc/chicken/language all extensions have to
 be installed with chicken-install and loaded with (use) or
 (require-extension). A list of it is available http://wiki.call-cc.org/eggs
 or searchable here: http://api.call-cc.org/doc/
 
 string ports are available throught the ports unit:
 http://api.call-cc.org/doc/ports

Heh seems there might be a confusion on my side.

open-output-string, get-output-string and get-output-string are
defined in the library unit, which is available by default.  If you
need more convenient procedures please have a look at the ports
unit.

Now while having a look at this I see that one can (use srfi-6)
without error because it is mapped to an internal already available
module, while (import srfi-6) does not. This seems to be a bug.

Thanks for noticing this!

Which information would you've liked to have before stumbling on
all of this? Maybe that would be a good place to start the improvements,
apart from the bug fixing...

Sorry for the inconveniences,

Christian


-- 
Who can (make) the muddy water (clear)? Let it be still, and it will
gradually become clear. Who can secure the condition of rest? Let
movement go on, and the condition of rest will gradually arise.
 -- Lao Tse. 

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] cannot import from undefined module

2012-03-07 Thread Mark Carter
Christian Kellermann ck...@pestilenz.org

 Thanks for noticing this!

I'm not sure if I in some way corrupted my install of chicken, but I 
removed the Debian version of chicken and obtained 
4.7.0.5-st.tar.gz 
from  
http://wiki.call-cc.org/stability
That seems to have fixed my issues. Phew.

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users