guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Any way I can I export a macro that expands to "private" symbols?


From: Rob Browning
Subject: Any way I can I export a macro that expands to "private" symbols?
Date: 29 Apr 2001 01:21:36 -0500
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7

Is there any way I can export a macro that expands to reference
non-exported symbols?  I've had a few cases lately where this would
have been very useful.  One example is where you'd like to make
handling optional arguments more efficient for the 0 and 1 arg cases.

I'm not sure this would make sense, but it seems somewhat useful until
case-lambda is available and our loader (or compiler) knows how to
optimize it.

For example:

  (define-module (testmod))

  (use-modules (ice-9 syncase))

  (define (foo-helper-single x) (do-something))
  (define (foo-helper-multi . args) (do-something-else))

  (define-syntax foo
    (syntax-rules ()
      ((foo) #f)
      ((foo x) (foo-helper-single x))))
      ((foo x-1 x-2 ...) (foo-helper-multi x-1 x-2 ...))))

  (export-syntax foo)

-- 
Rob Browning <address@hidden> PGP=E80E0D04F521A094 532B97F5D64E3930



reply via email to

[Prev in Thread] Current Thread [Next in Thread]