Hi,
Was wondering about the common practice: which would you do if two packages which you want to use both export the same symbol? (In this case both iterate and cl-containers export "finish").
Using fully qualified iterate names creates really messy code, so I'd probably keep iterate in any event (besides, afaik iterate manipulates symbol-plist, so its important to use its symbols). But stuff like (cl-containers:size var) looks like a mouthful too!
So, what would you do, use fully-qualified cl-containers names, or do some exporting-importing-shadowing magic to get nicer looking source?
Conflict between iterate and cl-containers
-
- Posts: 166
- Joined: Sun Nov 28, 2010 4:21 pm
Re: Conflict between iterate and cl-containers
Personally, I normally use package names for libraries written by other people, but, like your usage of iterate, parenscript is obfuscated when used in this style, so I have a second package that :USEs parenscript, so I don't need to worry about package contamination in most of my code.
For your case you may want to create a wrapper with a different name in your package, this is actually an area where I think common-lisp is a bit unfortunate: I think you should be able to import symbols into a package under another name than its SYMBOL-NAME, since the reader uses a hash-table for symbol lookup it would seem to be a trivial thing to add.
For your case you may want to create a wrapper with a different name in your package, this is actually an area where I think common-lisp is a bit unfortunate: I think you should be able to import symbols into a package under another name than its SYMBOL-NAME, since the reader uses a hash-table for symbol lookup it would seem to be a trivial thing to add.
Re: Conflict between iterate and cl-containers
Look at SHADOW and SHADOWING-IMPORT.
Marco Antoniotti
Re: Conflict between iterate and cl-containers
Hi! I use patched version of iterate, http://sourceforge.net/projects/iteratekeywords/
It allows using keywords in head clauses.
So I write
(iter (:for x :in ...) (:collect ...))
instead of
(iter (iter:for x :in ...) (iter:collect ... ))
so no obfuscation and no conflicts.
It allows using keywords in head clauses.
So I write
(iter (:for x :in ...) (:collect ...))
instead of
(iter (iter:for x :in ...) (iter:collect ... ))
so no obfuscation and no conflicts.
Re: Conflict between iterate and cl-containers
The real question is:
Are you sure you need ITERATE? I.e., are you sure you couldn't just use LOOP?
Cheers
--
MA
Are you sure you need ITERATE? I.e., are you sure you couldn't just use LOOP?
Cheers
--
MA
Marco Antoniotti