254 |
This example also shows how to use the convenience procedure |
This example also shows how to use the convenience procedure |
255 |
@code{symbol-prefix-proc}. |
@code{symbol-prefix-proc}. |
256 |
|
|
257 |
|
You can also directly refer to bindings in a module by using the |
258 |
|
@code{@@} syntax. For example, instead of using the |
259 |
|
@code{use-modules} statement from above and writing |
260 |
|
@code{unixy:pipe-open} to refer to the @code{pipe-open} from the |
261 |
|
@code{(ice-9 popen)}, you could also write @code{(@@ (ice-9 popen) |
262 |
|
open-pipe)}. Thus an alternative to the complete @code{use-modules} |
263 |
|
statement would be |
264 |
|
|
265 |
|
@smalllisp |
266 |
|
(define unixy:pipe-open (@@ (ice-9 popen) open-pipe)) |
267 |
|
(define unixy:close-pipe (@@ (ice-9 popen) close-pipe)) |
268 |
|
@end smalllisp |
269 |
|
|
270 |
|
There is also @code{@@@@}, which can be used like @code{@@}, but does |
271 |
|
not check whether the variable that is being accessed is actually |
272 |
|
exported. Thus, @code{@@@@} can be thought of as the impolite version |
273 |
|
of @code{@@} and should only be used as a last resort or for |
274 |
|
debugging, for example. |
275 |
|
|
276 |
|
Note that just as with a @code{use-modules} statement, any module that |
277 |
|
has not yet been loaded yet will be loaded when referenced by a |
278 |
|
@code{@@} or @code{@@@@} form. |
279 |
|
|
280 |
|
You can also use the @code{@@} and @code{@@@@} syntaxes as the target |
281 |
|
of a @code{set!} when the binding refers to a variable. |
282 |
|
|
283 |
@c begin (scm-doc-string "boot-9.scm" "symbol-prefix-proc") |
@c begin (scm-doc-string "boot-9.scm" "symbol-prefix-proc") |
284 |
@deffn {Scheme Procedure} symbol-prefix-proc prefix-sym |
@deffn {Scheme Procedure} symbol-prefix-proc prefix-sym |
285 |
Return a procedure that prefixes its arg (a symbol) with |
Return a procedure that prefixes its arg (a symbol) with |
328 |
as well as installing it as the current system transformer. |
as well as installing it as the current system transformer. |
329 |
@end deffn |
@end deffn |
330 |
|
|
331 |
|
@deffn syntax @@ module-name binding-name |
332 |
|
Refer to the binding named @var{binding-name} in module |
333 |
|
@var{module-name}. The binding must have been exported by the module. |
334 |
|
@end deffn |
335 |
|
|
336 |
|
@deffn syntax @@@@ module-name binding-name |
337 |
|
Refer to the binding named @var{binding-name} in module |
338 |
|
@var{module-name}. The binding must not have been exported by the |
339 |
|
module. This syntax is only intended for debugging purposes or as a |
340 |
|
last resort. |
341 |
|
@end deffn |
342 |
|
|
343 |
@node Creating Guile Modules |
@node Creating Guile Modules |
344 |
@subsection Creating Guile Modules |
@subsection Creating Guile Modules |