chicken-users
[Top][All Lists]
Advanced

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

[Chicken-users] Fwd: Understanding modules?


From: Norman Gray
Subject: [Chicken-users] Fwd: Understanding modules?
Date: Wed, 16 Mar 2016 17:01:30 +0000


Greetings.

Oleg Kolosov also sent the reply below, but accidentally sent it only to me and not the list; he's asked me to forward it here.

Thank you Oleg and John, for these explanations. I won't be back in Chicken-land for a couple of days, but as soon as I can I'll aim to understand this point well enough to offer a draft of additional text for the manual.

Best wishes,

Norman


Forwarded message:

From: Oleg Kolosov <address@hidden>
To: Norman Gray <address@hidden>
Subject: Re: [Chicken-users] Understanding modules?
Date: Tue, 15 Mar 2016 23:10:20 +0300


On 15 Mar 2016, at 21:28, Norman Gray <address@hidden> wrote:


Greetings.

...again, on my second day with Chicken. I can't easily tell from the docs what is the idiomatic pattern for usage of Chicken modules. Can anyone point me to a reference?

[ I hope it's useful to ask these somewhat beginner questions. ...

Hello! You've got quite far on your second day. I'll try to clarify a few points.

You are right that unit files are, in fact, just C object files, this feature is CHICKEN specific, not portable and its usage is generally frowned upon. Everything is compiled into single output file with unified global namespace, the standard library is automatically available, you do not need to import anything but the downside is - you will not get compilation warnings for undefined identifiers and such. You can use it for special cases like separate compilation (like in C) or when the sources are partially generated.

The module support in Scheme was standardized some time ago but CHICKEN implementation precedes the standard and have some quirks and special features.

AFAIR the 'import' statement tries to load *.import.scm or *.import.so from <prefix>/lib/chicken/?/ which are generated by 'emit-...-import-library' options. *.import.scm can also be loaded from the current directory or include-paths passed in command line. Having these separate 'import libraries' is very useful when cross-compiling for different architecture because it is not possible to load foreign modules during compilation to check exported names and such.

See the same lib path for <name>.so files. Those <name>.so which have the corresponding <name>.import.so - are externally installed modules which you need to 'use' or 'require-extension'. The rest *.import.so - are modules provided by the CHICKEN itself, which are always loaded with runtime and you need to just 'import' to make them visible in your own modules. Some names are built-in and do not have the corresponding file, these are also 'import only'.

—
Regards, Oleg
Art-System

--
Norman Gray  :  https://nxg.me.uk
SUPA School of Physics and Astronomy, University of Glasgow, UK




reply via email to

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