<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body 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 class="moz-signature" cols="72">--
Ryan Davis
Acceleration.net
Director of Programming Services
2831 NW 41st street, suite B
Gainesville, FL 32606
Office: 352-335-6500 x 124
Fax: 352-335-6506</pre>
</body>
</html>