Mailing List Archive

RFC: namespaces
Varnish is going to consist of quite a bit of code, and I'd like to
keep separate modules in separate namespaces. I'd like to suggest the
following convention:

- All external symbols get a three-letter prefix followed by an
underscore.

- The first letter is always v for Varnish.

- The next two letters identify the module the symbol belongs to.
Each module gets a unique two-letter mnemonic code.

For instance we could assign the two-letter code "lo" to the logger;
logging functions would be named e.g. vlo_emit(), and log-related
preprocessor macros would be named e.g. VLO_LEVEL_DEBUG.

DES
--
Dag-Erling Sm?rgrav
Senior Software Developer
Linpro AS - www.linpro.no
RFC: namespaces [ In reply to ]
Varnish is going to consist of quite a bit of code, and I'd like to
keep separate modules in separate namespaces. I'd like to suggest the
following convention:

- All external symbols get a three-letter prefix followed by an
underscore.

- The first letter is always v for Varnish.

- The next two letters identify the module the symbol belongs to.
Each module gets a unique two-letter mnemonic code.

For instance we could assign the two-letter code "lo" to the logger;
logging functions would be named e.g. vlo_emit(), and log-related
preprocessor macros would be named e.g. VLO_LEVEL_DEBUG.

DES
--
Dag-Erling Sm?rgrav
Senior Software Developer
Linpro AS - www.linpro.no
RFC: namespaces [ In reply to ]
In message <ujru0alw25m.fsf at cat.linpro.no>, Dag-Erling =?iso-8859-1?Q?Sm=F8rgra
v?= writes:

>For instance we could assign the two-letter code "lo" to the logger;
>logging functions would be named e.g. vlo_emit(), and log-related
>preprocessor macros would be named e.g. VLO_LEVEL_DEBUG.

Sounds a bit like overkill to me, but if it makes you happy I can
live with it.

--
Poul-Henning Kamp | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG | TCP/IP since RFC 956
FreeBSD committer | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.
RFC: namespaces [ In reply to ]
In message <ujru0alw25m.fsf at cat.linpro.no>, Dag-Erling =?iso-8859-1?Q?Sm=F8rgra
v?= writes:

>For instance we could assign the two-letter code "lo" to the logger;
>logging functions would be named e.g. vlo_emit(), and log-related
>preprocessor macros would be named e.g. VLO_LEVEL_DEBUG.

Sounds a bit like overkill to me, but if it makes you happy I can
live with it.

--
Poul-Henning Kamp | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG | TCP/IP since RFC 956
FreeBSD committer | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.
RFC: namespaces [ In reply to ]
"Poul-Henning Kamp" <phk at phk.freebsd.dk> writes:
> "Dag-Erling Sm?rgrav" <des at des.no> writes:
> > For instance we could assign the two-letter code "lo" to the logger;
> > logging functions would be named e.g. vlo_emit(), and log-related
> > preprocessor macros would be named e.g. VLO_LEVEL_DEBUG.
> Sounds a bit like overkill to me, but if it makes you happy I can
> live with it.

Well, the alternatives are worse IMHO:

open_log(const char *); /* conflicts with libfoobar */
varnish_open_log(const char *); /* too long */
open(const char *); /* oops */
vlo_open(const char *); /* that's better! */

DES
--
Dag-Erling Sm?rgrav
Senior Software Developer
Linpro AS - www.linpro.no
RFC: namespaces [ In reply to ]
"Poul-Henning Kamp" <phk at phk.freebsd.dk> writes:
> "Dag-Erling Sm?rgrav" <des at des.no> writes:
> > For instance we could assign the two-letter code "lo" to the logger;
> > logging functions would be named e.g. vlo_emit(), and log-related
> > preprocessor macros would be named e.g. VLO_LEVEL_DEBUG.
> Sounds a bit like overkill to me, but if it makes you happy I can
> live with it.

Well, the alternatives are worse IMHO:

open_log(const char *); /* conflicts with libfoobar */
varnish_open_log(const char *); /* too long */
open(const char *); /* oops */
vlo_open(const char *); /* that's better! */

DES
--
Dag-Erling Sm?rgrav
Senior Software Developer
Linpro AS - www.linpro.no
RFC: namespaces [ In reply to ]
In message <ujrirr0x5ud.fsf at cat.linpro.no>, Dag-Erling =?iso-8859-1?Q?Sm=F8rgra
v?= writes:

>Well, the alternatives are worse IMHO:
>
>open_log(const char *); /* conflicts with libfoobar */
>varnish_open_log(const char *); /* too long */
>open(const char *); /* oops */
>vlo_open(const char *); /* that's better! */

Well, I would tend to consider the varnish process + mgt_process
namespace "private" and therefore not in need of a lot of prefix
whereas for the public API I fully agree a prefix is in order.

But as I said: I can live with it.

--
Poul-Henning Kamp | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG | TCP/IP since RFC 956
FreeBSD committer | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.
RFC: namespaces [ In reply to ]
In message <ujrirr0x5ud.fsf at cat.linpro.no>, Dag-Erling =?iso-8859-1?Q?Sm=F8rgra
v?= writes:

>Well, the alternatives are worse IMHO:
>
>open_log(const char *); /* conflicts with libfoobar */
>varnish_open_log(const char *); /* too long */
>open(const char *); /* oops */
>vlo_open(const char *); /* that's better! */

Well, I would tend to consider the varnish process + mgt_process
namespace "private" and therefore not in need of a lot of prefix
whereas for the public API I fully agree a prefix is in order.

But as I said: I can live with it.

--
Poul-Henning Kamp | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG | TCP/IP since RFC 956
FreeBSD committer | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.