Re: Using a Macro Package

Madhu <[email protected]>
Newsgroups gmane.lisp.cmucl.general
Message-ID <E1K7lsq-0001qS-Aj@rhea>
  |From: Bill <[email protected]>
  |Date: Sun, 15 Jun 2008 02:00:53 -0400
  |
  |I'm using CMU CL 19d and I'm trying to use Jonathan Amsterdam's Iterate
  |macro package, v. 1.4.3.  Installation went fine, asdf and all that.  My
  |problem is that I can't find a way to use (in the package sense) it.
  |When I try use-package I get collisions with the symbols ITERATE and
  |COLLECT.  I don't care about colliding with the loop macro but I use the
  |CMU CL extension iterate.  The macro package provides iter as a synonym
  |for iterate for precisely this reason.
  |
  |Is there any way I can arrange to 1) use the symbols exported from the
  |iterate package without qualification and at the same time 2) use
  |ext:iterate.
 
CL allows you to shadow symbols when to work around problems of
collision in packages.  In this case you want to do a
CL:SHADOWING-IMPORT of the symbol from iterates' package. Then
EXT:ITERATE is available.

[I don't use condone the iterate macro, but the following example
should indicate how it works.  Look up SHADOW and SHADOWING-IMPORT in
the spec. Note DEFPACKAGE also allows you to specify how symbols can
be shadowed.]

* (describe 'iterate)

ITERATE is an external symbol in the EXTENSIONS package.
Macro-function: #<Byte function (:MACRO ITERATE) {280C0EF1}>
Macro documentation:
  Iterate Name ({(Var Initial-Value)}*) Declaration* Form*
  This is syntactic sugar for Labels.  It creates a local function Name with
  the specified Vars as its arguments and the Declarations and Forms as its
  body.  This function is then called with the Initial-Values, and the result
  of the call is return from the macro.
On Wednesday, 4/2/08 10:51:38 am MDT it was compiled from:
target:code/extensions.lisp
  Created: Sunday, 10/5/03 05:41:22 am MDT
  Comment: $Header: /project/cmucl/cvsroot/src/code/extensions.lisp,v 1.28 2003/10/05 11:41:22 gerd Exp $

* (defpackage "FOO" (:export "ITERATE"))

#<The FOO package, 0/8 internal, 1/2 external>

* (shadowing-import '(foo:iterate))

T

* (describe 'iterate)

ITERATE is an external symbol in the FOO package.

--
Madhu
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.