Re: [STUMP] Why does `defcommand' export the command symbol?

David Bjergaard <[email protected]>
Newsgroups gmane.comp.window-managers.stumpwm.devel
Message-ID <[email protected]>
"Diogo F. S. Ramos" <[email protected]> writes:

>> I think its there because a defcommand exposes commands to the user, and
>> so it makes sense that their exported from the package.  This is more a
>> policy than a requirement. (if the user can call the command, then other
>> parts of StumpWM itself should be able to call the command too.)
>>
>> I'm pretty sure the name is actually stored in the *command-hash* and
>> the call to make-command.  Maybe someone with more knowledge can
>> comment.
>>
>> Notice that the deprecated `DEFINE-STUMPWM-COMMAND' doesn't export
>> anything. It just defun's the name and stores the name (with metadata)
>> in the *command-hash*.
>
> I see.
>
> I am asking because such policy cause me a problem.
>
> By using `defcommand' in a module (separate package), I couldn't
> redefine the package because the symbols defining the commands were
> exported but they were not listed in my new package redefinition.
>
> Even if StumpWM should be able to call commands like the user, it won't
> happen as things are, because exported symbols need to be prefixed by
> the package exporting it.
>
> I wonder if we are better of by not exporting `defcommand' symbols.
Hmm,

This is a good point. If you were willing to do some archaeology, you
could see when the `export` was added.  To make sure I understand your
issue:

If you call (stumpwm:defcommand foo ...) from an external package, you
export foo from your package (ie module:foo), but you never defined
module:foo for your package, so your encountering an error?  

I have some vague memory of this being added in a pull request shortly
after I started maintaining stump...

Cheers,

    Dave

PS. Sorry for top posting
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.