Page 1 of 1

Conflict between iterate and cl-containers

Posted: Wed Dec 11, 2013 5:37 pm
by wvxvw
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? :)

Re: Conflict between iterate and cl-containers

Posted: Thu Dec 12, 2013 7:32 am
by pjstirling
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.

Re: Conflict between iterate and cl-containers

Posted: Thu Dec 12, 2013 1:39 pm
by marcoxa
Look at SHADOW and SHADOWING-IMPORT.

Re: Conflict between iterate and cl-containers

Posted: Sat Jan 04, 2014 8:30 am
by budden73
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.

Re: Conflict between iterate and cl-containers

Posted: Sun Jan 05, 2014 7:40 am
by marcoxa
The real question is:

Are you sure you need ITERATE? I.e., are you sure you couldn't just use LOOP?

Cheers
--
MA