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

Diff of /README.md

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 9 by rklochkov, Sun Dec 23 10:43:24 2012 UTC revision 14 by rklochkov, Fri Jan 25 14:09:35 2013 UTC
# Line 9  Features Line 9  Features
9  - local intern package like in SBCL: package::(symbol1 symbol2) will intern  - local intern package like in SBCL: package::(symbol1 symbol2) will intern
10                                       package::symbol1 and package::symbol2                                       package::symbol1 and package::symbol2
11    
12    To start
13    --------
14    
15    Either use named-readtables and write
16    
17        (in-readtable :advanced)
18    
19    or simply add to advanced-readtable to current readtable
20    
21        (advanced-readtable:!)
22    
23    Hierarchy packages
24    ------------------
25    
26    Advanced-readtable has fully functional built-in support of hierarchy-packages.
27    
28        CL-USER> (defpackage .test (:use cl)))
29        #<PACKAGE "COMMON-LISP-USER.TEST">
30        CL-USER> (in-package .test)
31        TEST> (in-package ..)
32        CL-USER> (defpackage .test.a (:use cl))
33        #<PACKAGE "COMMON-LISP-USER.TEST.A">
34        CL-USER> (in-package .test.a)
35        A> '...::car
36        CAR
37        A> (eq '...::car 'cl:car)
38        T
39        A> (in-package ...test)
40        TEST> (in-package ..)
41        CL-USER>
42    
43    
44    API
45    ===
46    
47  _push-import-prefix_ -- enables import prefix on package name  _push-import-prefix_ -- enables import prefix on package name
48  --------------------------------------------  --------------------------------------------
49    
# Line 51  rename LIB version 1 to LIB1 and LIB ver Line 86  rename LIB version 1 to LIB1 and LIB ver
86      (push-local-nickname :lib1 :lib :a)      (push-local-nickname :lib1 :lib :a)
87      (push-local-nickname :lib2 :lib :b)      (push-local-nickname :lib2 :lib :b)
88    
89    This command also adds local subpackage alias. In the previous example a.lib
90    and b.lib will be aliases to lib1 and lib2. If there is a real package with
91    such name, alias will be shadowed, so don't worry too much about it.
92    
93  _push-local-package_ -- sets local-package for a symbol  _push-local-package_ -- sets local-package for a symbol
94  ----------------------------------------------  ----------------------------------------------
95    
# Line 69  For example, this will be error: Line 108  For example, this will be error:
108    
109  , because first for is in ITERATE package, but second -- is not.  , because first for is in ITERATE package, but second -- is not.
110    
111    Be careful: this change is not local to your package.
112    
113  _set-macro-symbol_ - syntax is like set-macro-character,  _set-macro-symbol_ - syntax is like set-macro-character,
114  ------------------  ------------------
115    
116  But FUNC is binded to SYMBOL, not character.  But FUNC is binded to SYMBOL, not character. This symbol will be processed
117    in all cases, where it is not bounded by ||.
118    
119  Now you may make something like  Now you may make something like
120    
121      html:[body [table (as-html sql:[select * from t1])]]      html:[body [table (as-html sql:[select * from t1])]]
# Line 80  Now you may make something like Line 123  Now you may make something like
123  html:[ and sql:[ will have different handlers and you may mix them in  html:[ and sql:[ will have different handlers and you may mix them in
124  one expression.  one expression.
125    
126    Also it allows to make simple symbol-aliases. For example:
127    
128        (set-macro-symbol '|ALIAS| (lambda (stream symbol)
129                                     (declare (ignore stream symbol))
130                                       'advanced-readtables:push-local-package))
131    Now you may do
132    
133        (alias 'iter:iter :iterate)
134    
135    Moreover, you may alias variables from other packages and set them through
136    alias. But be careful: this change is not local to your package.
137    
138    
139  _get-macro-symbol_ - syntax is like get-macro-character,  _get-macro-symbol_ - syntax is like get-macro-character,
140  ------------------  ------------------
141    

Legend:
Removed from v.9  
changed lines
  Added in v.14

  ViewVC Help
Powered by ViewVC 1.1.5