For your specific example, I would do some combination of<div><ul><li>Figure out why there are 2 GET-WAN-IPS helpers, how they differ, and factor to a single function.</li><li>Change GET-WAN-IP to a generic function and factor.</li>
<li>Create another package and factor.</li></ul>The entire point of packages is to avoid name conflicts. So, if you are experiencing a name conflict in a single package, it's time to factor the code.</div><div><br></div>
<div>Search the archives for a recent discussion on conflicts between packages, maybe that has some insight that is applicable to your issue.</div><div><br></div><div>Good luck,</div><div><br></div><div>Tom<br>----------------------------------------------------------------<br>
Thomas M. Hermann<br>Odonata Research LLC<br><a href="http://www.odonata-research.com/">http://www.odonata-research.com/</a><br><a href="http://www.linkedin.com/in/thomasmhermann">http://www.linkedin.com/in/thomasmhermann</a><br>
<br><br><div class="gmail_quote">On Wed, Apr 13, 2011 at 1:35 PM, Ryan Davis <span dir="ltr"><<a href="mailto:ryan@acceleration.net">ryan@acceleration.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div text="#000000" bgcolor="#ffffff">
When working on a larger lisp code base, one with 10+ files in one
package, I begin to get nervous about accidental name conflicts, and
was wondering how other people deal with this.<br>
<br>
Here's the scenario I'm worried about:<br>
<ul>
<li>dsl.lisp, written by a coworker two years ago, has a number of
small functions that are helpers for the main #'WRITE-DSL-REPORT
function; one of these helpers is #'GET-WAN-IPS<br>
</li>
<li>nagios-config.lisp, written by me today, has a number of small
functions that are helpers for the main #'WRITE-NAGIOS-CONFIG
function; one of these helpers is #'GET-WAN-IPS</li>
<li>I miss the compiler warning about redefining #'GET-WAN-IPS<br>
</li>
<li>I test my code, it works in my REPL so I commit and call it a
day<br>
</li>
<li>Code eventually gets pushed to production and
#'WRITE-DSL-REPORT is broken<br>
</li>
</ul>
It doesn't happen very often (and testing procedures usually catch
stuff before it goes to production), but it seems like there should
be a nicer way to deal with helper functions that you want to
develop/test from the REPL, but don't need to be used outside the
current file. <br>
<br>
I had a few ideas to solve it, none of which I really like. I could
add a top-level FLET for the file, but the extra indentation will be
annoying and it'll be harder to test/maintain those helper
functions. I could define a helper package, per-file, and put my
helper functions in that package (e.g. (defun
nagios-config-helpers::get-wan-ips ...)), but that feels funny and
awkward, which usually means it's a bad idea. I could break up my
code into many smaller packages, each exporting and importing the
functions needed elsewhere in the system, but that seems like recipe
for dependency headaches and a lot of unneeded paperwork.<br>
<br>
Do other people have this anxiety? Are there elegant ways to deal
with it? (besides medication and more unit testing)<br>
<br>
Thanks,<br>
<pre cols="72">--
Ryan Davis
Acceleration.net
Director of Programming Services
2831 NW 41st street, suite B
Gainesville, FL 32606
Office: <a href="tel:352-335-6500" value="+13523356500" target="_blank">352-335-6500</a> x 124
Fax: <a href="tel:352-335-6506" value="+13523356506" target="_blank">352-335-6506</a></pre>
</div>
<br>_______________________________________________<br>
pro mailing list<br>
<a href="mailto:pro@common-lisp.net">pro@common-lisp.net</a><br>
<a href="http://common-lisp.net/cgi-bin/mailman/listinfo/pro" target="_blank">http://common-lisp.net/cgi-bin/mailman/listinfo/pro</a><br>
<br></blockquote></div><br></div>