:DBG
Alessio Stalla
alessiostalla at gmail.com
Mon Nov 18 09:16:13 UTC 2013
Right; I think it avoids the problem altogether, rather than solving it.
I.e. if you (and the libraries you use) do things right, you don't have to
think about the problem at all. In languages without packages, when people
want to "solve" the same problem, they end up prefixing every symbol
(ugh!), or fake namespaces in some hackish way (see JavaScript).
Lately I'm thinking more and more that keywords are a hack and shouldn't
have been in CL at all. 'foo is just as easy to type as :foo, but it allows
'my:foo to coexist with 'your:foo.
On Mon, Nov 18, 2013 at 10:08 AM, Pascal Costanza <pc at p-cos.net> wrote:
> It hasn't been a problem in the past, because people stuck to the rules,
> at least in publicly available libraries, which is why you didn't observe
> any problems. If people stop sticking to the rules, it will become a
> problem.
>
> Pascal
>
> Sent from my iPad
>
> On 18 Nov 2013, at 10:00, Ken Tilton <kentilton at gmail.com> wrote:
>
> I for one have never understood the anal compulsiveness* of many Lispers
> over package sanctity.
>
> * Does it solve a problem, or is it just aneatness obsession?
>
> Dis donc, francois, how did you handle source that might be a good-sized
> little sexpr?
>
> -- His Professionalness
>
>
>
> On Mon, Nov 18, 2013 at 3:44 AM, Alessio Stalla <alessiostalla at gmail.com>wrote:
>
>> Well, Faré is obviously well aware of that, and has given an explanation
>> for why he is willing to "break the rules" this particular time. So "don't
>> dare touch the keywords package!" does not seem the right answer to me...
>> Faré, I understand your points, what fails me is: if this is a debug
>> macro nobody won't ever use in production code, why make it available in a
>> library at all? Why couldn't it simply live in your rc file? Or, you could
>> include it in uiop with a non-keyword name, and only bind it to :dbg in
>> your own environment. I fail to understand why you'd want to it be
>> available everywhere, everytime... and for everyone as well!
>>
>> Alessio
>>
>>
>> On Mon, Nov 18, 2013 at 9:28 AM, Pascal Costanza <pc at p-cos.net> wrote:
>>
>>> Hm, just when I thought this the mailing list for professional Common
>>> Lisp users.
>>>
>>> Off the top of my hat:
>>> http://www.lispworks.com/documentation/HyperSpec/Body/11_abcb.htm
>>>
>>> Pascal
>>>
>>> Sent from my iPad
>>>
>>> On 18 Nov 2013, at 08:51, Hans Hübner <hans.huebner at gmail.com> wrote:
>>>
>>> Pascal,
>>>
>>> if you mean what you write, can you give some reasoning?
>>>
>>> -Hans
>>>
>>>
>>> 2013/11/18 Pascal Costanza <pc at p-cos.net>
>>>
>>>> DON'T TOUCH THE KEYWORDS PACKAGE! Are you crazy?!?
>>>>
>>>> This will be setting a very bad precedence. Just don't. Really!
>>>>
>>>> Pascal
>>>>
>>>> Sent from my iPad
>>>>
>>>> > On 18 Nov 2013, at 06:17, Faré <fahree at gmail.com> wrote:
>>>> >
>>>> > In ASDF 3.1.0.14, I introduced a macro :DBG (in uiop/utility.lisp).
>>>> > Yes, it's in the keyword package. Why?
>>>> > Because it's the one and only macro I want to be accessible from
>>>> everywhere
>>>> > without a prefix, yet without modifying existing defpackage forms to
>>>> make
>>>> > it accessible — because it's only used temporarily for debugging.
>>>> >
>>>> > :DBG is a macro for print-debugging. The syntax is
>>>> > (:DBG tag forms... last-form)
>>>> > The semantics is that if tag is true, print the tag, then for each
>>>> > form, write its source and its values; return the values of the last
>>>> > form. If tag is false, just evaluate the last form and return its
>>>> > values. (Tag is typically a constant keyword or string, identifying
>>>> > the point where values are printed.)
>>>> > The expansion is rather space and time efficient, as far as the
>>>> > semantics permit.
>>>> >
>>>> > I find :DBG soooo useful for print-debugging. I've seen tens of
>>>> > variants of it, but every time with something not quite right in the
>>>> > syntax, semantics or implementation. I just wanted one variant that
>>>> > got everything right, and make it ubiquitous. Because when you need
>>>> > it, you need it now, and there's no time to modify things to load an
>>>> > additional library. And when you're done, you want minimal cleanup,
>>>> > too: just delete the form, except maybe keep the last subform.
>>>> >
>>>> > Previously, I was using (uiop:uiop-debug) from uiop/utility which
>>>> > allows you to load a magic file of your choice that defines a debug
>>>> > mode. The default one I provided was mine, which define :DBG as DBG in
>>>> > your current package (thereby avoiding symbol import issues). But that
>>>> > still adds a new definition everytime and an extra line or form to
>>>> > cleanup.
>>>> >
>>>> > I was recently convinced that using the keyword package instead makes
>>>> > perfect sense: on the one hand, that's using a shared namespace that
>>>> > it is polite to not pollute, but on the other hand, such a temporary
>>>> > print-debugging macro the only use case I imagine of otherwise wanting
>>>> > something to be immediately accessible without package prefixing yet
>>>> > without modifying the package definition form.
>>>> >
>>>> > It's still time to remove that macro before the next release, but I
>>>> > believe it's the right thing to include it, and maybe some of you will
>>>> > agree with me and start using it, if not from the yet unrelease ASDF
>>>> > 3.1.1, perhaps from a copy in your .sbclrc.
>>>> >
>>>> > —♯ƒ • François-René ÐVB Rideau •Reflection&Cybernethics•
>>>> http://fare.tunes.org
>>>> > The common argument that crime is caused by poverty
>>>> > is a kind of slander on the poor.
>>>> > — H. L. Mencken
>>>> >
>>>>
>>>>
>>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/pro/attachments/20131118/27389911/attachment.html>
More information about the pro
mailing list