:: Re: [Libbitcoin] Network namespace
Top Page
Delete this message
Reply to this message
Author: Eric Voskuil
Date:  
To: Amir Taaki, libbitcoin
Subject: Re: [Libbitcoin] Network namespace
It is called for by the road map, under the libbitcoin (bc) namespace:

https://wiki.unsystem.net/en/index.php/Libbitcoin
https://lists.dyne.org/lurker/message/20140924.201619.e3930350.en.html

The reason it was done in advance of splitting out the library was that
we encountered a naming conflict with libitcoin-protocol. Following
convention this library requires the namespace bc::protocol. The library
must be independent as it contains code that must be shared across
client and server. It also requires the libbitcoin dependency.

However libbitcoin (in the current bc::network namespace) contains a
class called "protocol" (and one called network). Creating the namespace
in advance of splitting out the library seemed the most straightforward
solution and advanced us on the road map.

Personally I'm not so concerned with namespaces in C++. The Boost
namespace organization works well. It's the using statement that is
hazardous (and should never be used in a header).

e

On 10/08/2014 05:54 AM, Amir Taaki wrote:
> What is the purpose behind putting the network code in libbitcoin under
> a separate namespace? Do we plan to split this code off into a
> libbitcoin-network module?
>
> The purpose of C++ namespaces is to avoid name conflicts. Unlike Java
> where the code is organised in highly recursive namespaces, C++
> namespaces are supposed to be flat. It is considered bad practice to use
> namespaces to organise code.
>
> If we plan to keep it as part of libbitcoin(-system) then maybe it
> should be moved into the top-level libbitcoin namespace.
>
> Take this more as a question rather than a recommendation.
>
>
>
>
> _______________________________________________
> Libbitcoin mailing list
> Libbitcoin@???
> https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/libbitcoin
>