Review of Jose Armando Garcia Sancio's std.log

Steven Schveighoffer schveiguy at yahoo.com
Wed Mar 7 06:37:36 PST 2012


On Tue, 06 Mar 2012 14:27:17 -0500, Jose Armando Garcia  
<jsancio at gmail.com> wrote:

> On Mon, Mar 5, 2012 at 5:32 PM, Jonathan M Davis <jmdavisProg at gmx.com>  
> wrote:
>> On Tuesday, March 06, 2012 02:22:05 so wrote:
>>> That is not a counter-argument to something related to this
>>> library but everything that lies in global namespace.
>>> At its first state both severity levels and the "log" was in
>>> global namespace. Now only severity levels.
>>>
>>> You are also overlooking one crucial fact that this library will
>>> be part of phobos, standard library. Which requires everyone to
>>> adopt. When you see codes like this (below), you don't blame
>>> standard library designers do you?
>>>
>>> using namespace std;
>>> int cout;
>>
>> Except that cout is not exactly something that would be considered a  
>> normal
>> variable name. Something like info _is_. This logging module is taking
>> incredibly common names and shoving them as far into the global  
>> namespace as
>> anything can go in D which isn't a compiler built-in. _Not_ a good idea  
>> IMHO -
>> not without good reason. And I really don't think that this merits it.
>> log!info(msg) would work just fine and would be _far_ better.
>
> using namesapce std;
>
> matrix vector = new Matrix(...)
>
> The variable vector conflicts with std::vector. Honestly, I can sit
> here and come up with 10s or 100s of example where you want to use a
> symbol that is expose by another module. You don't have to go far just
> look at druntime and phobos. This the exact reason why modules and
> namespace exist and one of the reason why people hate C's preprocessor
> macros. D solved this problem years ago.

The not so trivial and important difference is here:

using namespace std;

That is, the default is, vector is *NOT* imported into your namespace.

For D modules, it is.

-Steve


More information about the Digitalmars-d mailing list