News for hackers. Stuff that matters.
Re:ES6 in Depth: Symbols (2015) by masklinn on Wednesday July 12, 2017 @07:12AM (#14751546)
> In lisp and ruby, `:a == :a` is true, while in JavaScript `Symbol("a") == Symbol("a")` is false.

But `Symbol.for("a") === Symbol.for("a")`, and Symbol("a") is very similar to (make-symbol "a").

Re:ES6 in Depth: Symbols (2015) by gvx on Wednesday July 12, 2017 @07:50AM (#14751708)
I'm designing a programming language that has symbols that are namespaced to objects, where two symbols are equal iff the object they're linked to is the same and their string representation is the same.

In that language, the equivalent of :a == :a would be true, and you would use different "namespace objects" to prevent collisions.

For example, classes that implement the function interface could provide methods named call and partial, that are namespaced to the function class object, leaving you free to define methods with those names but different namespaces for completely different purposes.

Re:ES6 in Depth: Symbols (2015) by acjohnson55 on Wednesday July 12, 2017 @09:21AM (#14752255)
Why is that helpful? In JS, the way you accomplish the same thing is to assign the single instance of the symbol to a property in your module, and that's how you access it, rather than summoning it with the Symbol function. Not sure what the machinery you're suggesting buys you, but I could be missing something!
Re:ES6 in Depth: Symbols (2015) by gvx on Thursday July 13, 2017 @02:40PM (#14763952)
I don't suppose it buys you anything JS can't do, but it does allow those things to be integrated closely in the language, in a way JS can't do without majorly breaking the language.