You are looking at historical revision 42883 of this page. It may differ significantly from its current revision.

dynamic-import

Documentation

A dynamic import facility for CHICKEN Scheme.

Usage

(import dynamic-import)

Note strongly suggest warnings be disabled before using dynamic-import: (enable-warnings #f).

"Warning: imported identifier doesn't exist in module ..." can occur due to missing exported identifiers during module search. Also, warnings from dynamic-import flow thru a different channel.

dynamic-import

[syntax] (dynamic-import IDs MODs [DEF])

Defines the identifiers IDs, imported from the first available module in MODs, using the default specification DEF when all modules are unproductive.

IDs ; (or symbol (list-of symbol)) ; single, or multiple, identifiers
MODs ; (or symbol (list-of symbol)) ; single, or multiple, module specifications
DEF
(default *) ; use (list * ...) as the default bindings
DEF
list ; use as the default bindings
DEF
((or integer list) --> list) ; use for the default bindings

(length IDs) must match (length DEFs).

dynamic-importer

[procedure] (dynamic-importer IDs MODs [DEF]) -> list

Returns the bindings for the identifiers IDs, from the first available module in MODs, using the default specification DEF when all modules are unproductive.

IDs ; (list-of symbol) ; identifiers
MODs ; (list-of symbol) ; module specifications
DEF
list ; use as the default bindings
DEF
((or integer list) --> list) ; use for the default bindings

(length IDs) must match (length DEFs).

dynamic-import-warning

[parameter] (dynamic-import-warning [WARN]) -> procedure

: WARN ; (#!rest -> void) ; warning procedure; default warning : WARN ; #t ; default : WARN ; #f ; void

Examples

(import dynamic-import)

;see note above
(enable-warnings #f)

;tcp-listen ... from tcp6 else (chicken tcp)
(dynamic-import
  (tcp-listen tcp-listener-fileno tcp-listener-port
   tcp-accept tcp-accept-ready? tcp-close
   tcp-abandon-port tcp-buffer-size tcp-connect
   tcp-read-timeout tcp-write-timeout)
  (tcp6 (chicken tcp)))

;ssl-connect* from openssl else stub
(dynamic-import ssl-connect* openssl (default (lambda _ (values #f #f))))

Bugs & Limitations

Notes

Requirements

srfi-1

test test-utils

Author

Kon Lovett

Repository

This egg is hosted on the CHICKEN Subversion repository:

https://anonymous@code.call-cc.org/svn/chicken-eggs/release/5/dynamic-import

If you want to check out the source code repository of this egg and you are not familiar with Subversion, see this page.

Version history

0.1.0
Removed tabulated-list-of}. Public Domain.
0.0.3
Drop warning-on; see error-utils warning-on.
0.0.2
Restrict import list, add warning-on.
0.0.1
Initial Release.

License

This code is in the public domain.