diff options
| author | 2024-07-29 14:01:20 -0400 | |
|---|---|---|
| committer | 2024-07-29 14:01:20 -0400 | |
| commit | 5a5fbd861fbd199a1611874d1810a41796bff83e (patch) | |
| tree | fd0b8cec56289032b374aa0e94bb819427325031 /README.rst | |
define-namespace and SRFI-1
Diffstat (limited to '')
| -rw-r--r-- | README.rst | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/README.rst b/README.rst new file mode 100644 index 0000000..77ce6bc --- /dev/null +++ b/README.rst @@ -0,0 +1,51 @@ +================ +define-namespace +================ + +DEFINE-NAMESPACE is an R5RS macro that implements a subset of R7RS's +DEFINE-LIBRARY. + +----- +Usage +----- + +Syntax:: + + (define-namespace namespace-name [DECL list]) + + DECL ::= (define defbody ...) + | (export [identifier list]) + | (import [IMPORTSPEC list]) + + IMPORTSPEC ::= (only ns [identifier list]) + ::= (rename ns [(identifier identifier) list] + + (import-from-namespace [IMPORTSPEC list]) + +Example:: + + (define-namespace ns + (define param 5) + (define (f x) (* 5 x)) + (export f)) + + (define-namespace ns2 + (import (rename ns (f g))) + (define (f x) (* 5 (g x))) + (export f)) + + (import-from-namespace (only ns2 f)) + + (f 17) + +--------------------- +Differences from R7RS +--------------------- + +* There are only EXPORT, IMPORT, and BEGIN statements. +* DEFINE-SYNTAX does not work. +* EXPORT statements must occur after DEFINEs. +* IMPORT only allows for ONLY and RENAME clauses. +* Namespace names are identifers, not lists. +* Namespaces are Scheme objects. +* To import outside of namespaces, use IMPORT-FROM-NAMSPACE, not IMPORT. |
