/[advanced-readtable]/README.md
ViewVC logotype

Contents of /README.md

Parent Directory Parent Directory | Revision Log Revision Log


Revision 9 - (hide annotations)
Sun Dec 23 10:43:24 2012 UTC (16 months ago) by rklochkov
File size: 3924 byte(s)
Added docs
1 rklochkov 9 advanced-readtable
2     ==================
3    
4     Features
5     - per-package aliases for packages
6     - per-package shortcuts for package hierarchies
7     - extendable find-package and find-symbol
8     - local use package in form package:(here form where package used)
9     - local intern package like in SBCL: package::(symbol1 symbol2) will intern
10     package::symbol1 and package::symbol2
11    
12     _push-import-prefix_ -- enables import prefix on package name
13     --------------------------------------------
14    
15     For example, you have packages com.clearly-useful.iterator-protocol, com.clearly-useful.reducers, ...
16     You may use them as
17    
18     (push-import-prefix :com.clearly-useful)
19     (iterator-protocol:do-iterator ...)
20     (reducers:r/map #'1+ data)
21    
22     and so on.
23     Package prefix is enabled per package so it is safe to use it in your package.
24    
25     If there is package, which name coincides with shortcut, package name has priority.
26    
27     So, if you make
28    
29     (defpackage :reducers ...)
30    
31     after that reducers:... will refer to new package, not com.clearly-useful.reducers.
32    
33     _push-local-nickname_ -- enables nickname for package in current package
34     -------------------------------------------
35    
36     Enables package nickname in CURRENT-PACKAGE.
37     For example, you found COM.INFORMATIMAGO.COMMON-LISP.CESARUM.LIST package and want to use
38     it. But don't want to USE-PACKAGE them, because some exported symbols from it are clashing
39     with yours.
40    
41     You may do it right:
42    
43     (push-local-nickname :com.informatimago.common-lisp.cesarum.list :ilist)
44     (ilist:circular-length l)
45    
46     Local-nicknames are local, so you may use it freely.
47    
48     If package A wants package LIB version 1, and package B wants package LIB version 2, one can simply
49     rename LIB version 1 to LIB1 and LIB version 2 to LIB2 and make
50    
51     (push-local-nickname :lib1 :lib :a)
52     (push-local-nickname :lib2 :lib :b)
53    
54     _push-local-package_ -- sets local-package for a symbol
55     ----------------------------------------------
56    
57     Many macroses use there own clauses.
58     For example, ITERATE uses FOR, COLLECT and so on.
59     If you don't want to USE-PACKAGE iterate, this function will help.
60    
61     (push-local-package 'iter:iter :iterate)
62     (iter:iter (for i from 1 to 10) (collect i))
63    
64     Caution: this function enables package substitution in all cases,
65     where SYMBOL is the car of a list.
66     For example, this will be error:
67    
68     (let (iter:iter for) (list iter:iter for))
69    
70     , because first for is in ITERATE package, but second -- is not.
71    
72     _set-macro-symbol_ - syntax is like set-macro-character,
73     ------------------
74    
75     But FUNC is binded to SYMBOL, not character.
76     Now you may make something like
77    
78     html:[body [table (as-html sql:[select * from t1])]]
79    
80     html:[ and sql:[ will have different handlers and you may mix them in
81     one expression.
82    
83     _get-macro-symbol_ - syntax is like get-macro-character,
84     ------------------
85    
86     Returns function, assigned by set-macro-symbol
87    
88     Low-level API
89     -------------
90    
91     There are five lists:
92     - *package-finders* -- global for find-package
93     - *symbol-finders* -- global for find-symbol
94     - (package-finders package) -- per-package for find-package
95     - (symbol-finders package) -- per-package for find-symbol
96     - (extra-finders symbol) -- per-symbol for (symbol ....) package substitution
97    
98     They are all alists. Key denotes handler and should be uniq for the list.
99     Value should have form (lambda (name package) ...) and return symbol for
100     symbol-finders and extra-finders and return pacakge for package-finders.
101    
102     You may freely change them to develop your own symbol or package schemes
103     (for example, hierarchy-packages, conduits and so on).
104    
105     Middle-level API
106     ----------------
107    
108     To simplify adding new handlers with keys there is macro _set-handler_
109    
110     (set-handler (package-finders pack) '(:my handler1) #'handler-func)
111    
112     will set handler for package pack, if there are no hanler with key
113     (:my handler1). So you may set it in your file and not be afraid, that it
114     will duplicate on reloading.

  ViewVC Help
Powered by ViewVC 1.1.5