Class.name on namespaces #2196

Closed
porfirioribeiro opened this Issue Mar 15, 2012 · 5 comments

Comments

Projects
None yet
4 participants

Hi.

Consider this example:

class Foo
class Foo.Bar
class Baz
class Baz.Bar

console.log(Foo.name)
console.log(Foo.Bar.name)
console.log(Baz.name)
console.log(Baz.Bar.name)

This will output:
Foo
Bar
Baz
Bar

The problem is i would never know where that Bar belongs!

On nested function CS could generate a diferent naming functions like:
Foo$Bar.name="Foo$Bar"; //or maybe Foo.Bar?
function Foo$Bar()...
I think this will not be too hard to implement...

But it would make a good job for debbuging.

Collaborator

michaelficarra commented Mar 16, 2012

What happens when you move Foo.Bar to Baz? Now Baz.Bar.name === "Foo.Bar". That's a whole lot more confusing to me.

that's what i'm using class exports.Shit.

-1 for mangling names.

Collaborator

michaelficarra commented Mar 16, 2012

Also related: #2052

Owner

jashkenas commented Mar 16, 2012

Yep -- let's not mangle names. If you want to name it a FooBar, just name it a FooBar.

@jashkenas jashkenas closed this Mar 16, 2012

Hmm, i understand your point of view.
It would introduce more mess than i tought.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment