[Bash-completion-devel] Namespace
David Paleino
dapal at debian.org
Tue May 3 19:44:28 UTC 2011
On Tue, 03 May 2011 21:51:19 +0300, Ville Skyttä wrote:
> But let's take a step back and establish the scope of all this, maybe
> it's kind of clear but it doesn't hurt write and discuss/confirm it: my
> opinion is that we should apply a namespace prefix to all our functions
> and non-local variables.
+1
> For variables, there are two things: 1) internal ones such as the
> current $_backup_glob and various similar per-completion ones, and 2)
> ones controlling behaviour such as the ones documented in
> doc/bash_completion.txt.
>
> For functions and internal variables we could use the same prefix (for
> example _bc_*). But for the "external" variables I think different
> conventions should apply. The current COMP_* is not optimal IMO because
> it's possible that they'll clash with bash's own COMP_*, so I suggest
> BASHCOMP_* for them.
+1 for BASHCOMP, it's even shorter than BASH_COMPLETION_ which we used
somewhere in the code up to now.
> And one important thing we should be planning for is considering what is
> the bash-completion "API", i.e. what external completion authors can use
> if they like and we'll try to keep that stuff stable, and what are
> private things not intended to be used outside bash-completion proper
> and which may change/disappear pretty much anytime. I think these
> deserve different namespaces, for example __bc_* or for the private ones
> and _bc_* for the API ones, or something that makes the difference even
> more visible such as _BC_* for the API ones. (All functions that are
> used as actual top level completion functions for commands would
> probably be private.)
I'd prefer _BC_*.
Also documenting them (and maybe putting doc on the website too) would be a
nice addition.
> Agreed/disagreed/other considerations?
Agreed on all the points. :)
--
. ''`. Debian developer | http://wiki.debian.org/DavidPaleino
: :' : Linuxer #334216 --|-- http://www.hanskalabs.net/
`. `'` GPG: 1392B174 ----|---- http://deb.li/dapal
`- 2BAB C625 4E66 E7B8 450A C3E1 E6AA 9017 1392 B174
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/bash-completion-devel/attachments/20110503/68afd0b4/attachment.pgp>
More information about the Bash-completion-devel
mailing list