[Chicken-users] newbie questions about macros in modules
From:
Imran Rafique
Subject:
[Chicken-users] newbie questions about macros in modules
Date:
Thu, 22 Jul 2010 16:46:39 -0700
Rank newbie here, so bear with me. I know these examples are somewhat contrived. I'm just trying to explore what I can (and can't do). I have a couple of questions regarding macro's inside a module.
1) how to define something so that its available within either a macro or a function
(define-for-syntax) doesn't make the binding available for use in a
function. And (define ...) has the opposite problem.
So far, the only way I've found to do this (thanks to the VERY helpful and patient guys on #chicken) is to create a secondary module, move my bindings into that, and then import it twice into the module where the macros and functions - which use those variables - are themselves defined.
Is there a better way?
2) module io defines a macro (debug-info) and a function (print-info). debug-info calls print-info. If module io is imported without a prefix, then it works. If module io is imported WITH a prefix, then the macro (debug-info) is trying to call a function (print-info) which isn't available (only <prefix>print-info is). Is there any way to account for this when creating the macro?
;;; ---- file: /home/imran/src/scheme/lib/io.scm ----
; this module define's all variables which I want available in module io for macro's and functions (module io_private * (import scheme chicken) (define _colours-on "\x1b[1;44;36m") (define _colours-off "\x1b[0m")
(define _debugging-colours-on "\x1b[1;31m") )