<div dir="ltr">packages do not obviate the need for prefixes, essential to code readability. And then we do need packages, the worst thing that ever happened to lisp..<div><br></div><div>but the problem here originates from a desire to share a debug hack, so the solution prolly involves a way to share debug hacks. Could be a fun project. We could call it :dbg.</div>
<div><br></div><div>-kt</div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Nov 18, 2013 at 2:56 AM, Stas Boukarev <span dir="ltr"><<a href="mailto:stassats@gmail.com" target="_blank">stassats@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">Faré <<a href="mailto:fahree@gmail.com">fahree@gmail.com</a>> writes:<br>
<br>
> In ASDF 3.1.0.14, I introduced a macro :DBG (in uiop/utility.lisp).<br>
> Yes, it's in the keyword package. Why?<br>
> Because it's the one and only macro I want to be accessible from everywhere<br>
> without a prefix, yet without modifying existing defpackage forms to make<br>
> it accessible — because it's only used temporarily for debugging.<br>
><br>
> :DBG is a macro for print-debugging. The syntax is<br>
> (:DBG tag forms... last-form)<br>
> The semantics is that if tag is true, print the tag, then for each<br>
> form, write its source and its values; return the values of the last<br>
> form. If tag is false, just evaluate the last form and return its<br>
> values. (Tag is typically a constant keyword or string, identifying<br>
> the point where values are printed.)<br>
> The expansion is rather space and time efficient, as far as the<br>
> semantics permit.<br>
><br>
> I find :DBG soooo useful for print-debugging. I've seen tens of<br>
> variants of it, but every time with something not quite right in the<br>
> syntax, semantics or implementation. I just wanted one variant that<br>
> got everything right, and make it ubiquitous. Because when you need<br>
> it, you need it now, and there's no time to modify things to load an<br>
> additional library. And when you're done, you want minimal cleanup,<br>
> too: just delete the form, except maybe keep the last subform.<br>
><br>
> Previously, I was using (uiop:uiop-debug) from uiop/utility which<br>
> allows you to load a magic file of your choice that defines a debug<br>
> mode. The default one I provided was mine, which define :DBG as DBG in<br>
> your current package (thereby avoiding symbol import issues). But that<br>
> still adds a new definition everytime and an extra line or form to<br>
> cleanup.<br>
><br>
> I was recently convinced that using the keyword package instead makes<br>
> perfect sense: on the one hand, that's using a shared namespace that<br>
> it is polite to not pollute, but on the other hand, such a temporary<br>
> print-debugging macro the only use case I imagine of otherwise wanting<br>
> something to be immediately accessible without package prefixing yet<br>
> without modifying the package definition form.<br>
><br>
> It's still time to remove that macro before the next release, but I<br>
> believe it's the right thing to include it, and maybe some of you will<br>
> agree with me and start using it, if not from the yet unrelease ASDF<br>
> 3.1.1, perhaps from a copy in your .sbclrc.<br>
</div></div>Thanks for breaking my :dbg macro.<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
With best regards, Stas.<br>
<br>
</font></span></blockquote></div><br></div>