http://codereview.chromium.org/115024/diff/1021/1028
File test/cctest/test-func-name-inference.cc (right):

http://codereview.chromium.org/115024/diff/1021/1028#newcode42
Line 42: namespace i = ::v8::internal;
On 2009/05/20 16:56:16, brettw wrote:
> On 2009/05/20 13:29:30, Mikhail Naganov wrote:
> > On 2009/05/19 20:22:41, brettw wrote:
> > > I didn't know you could even do this, and I looked at a couple
other test
> > files
> > > and they just say "using". I think i is particularly confusing
since it's
> > often
> > > used as a loop index (I realize they won't collide).
> > >
> > > I realize you're trying to be nicer not bringing all of v8 into
your scope,
> > but
> > > I think using or saying v8::internal everywhere are more clear
than this
> > > uncommon syntax.
> >
> > I've got rid of this namespace alias, but want to mention that this
idiom
> isn't
> > uncommon in V8: grep for "namespace = i" and you'll find a couple of
entries:
> >
> > src/d8.h:38:namespace i = v8::internal;
> > src/mksnapshot.cc:42:namespace i = v8::internal;
> > src/v8.h:95:namespace i = v8::internal;
> > test/cctest/test-api.cc:59:namespace i = ::v8::internal;
> >
> > Also namespace aliases are allowed by the style guide too:
> >

http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml?showone=Namespaces#Namespaces
> > (see the very end of the section).

> I learn something every time! If you do this, I think "i" is a bad
namespace
> alias, though, given the common use of i for other things.

Coming to Mikhail's defense here. One of the style guide's principles is
to stay consistent with existing code. The namespace i:: use is rather
common in the rest of the V8 code where we need to refer to the
v8::internal namespace, although I like Mikhail's current solution
better because it specifically names the internal classes his test code
is using.

-Ivan

http://codereview.chromium.org/115024

--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to