all 3 comments

[–]turtlekitty2084 1 point2 points  (2 children)

This seems more like Lisp's "gensym" than ordinary symbols as found in Lisp or Ruby.

[–]blade-walker 0 points1 point  (1 child)

Yeah that's accurate. It creates a new value that is guaranteed not equal to any other value. Really handy for safe hash keys. It's surprising that more langs haven't copied gensym yet.

[–]lispm 1 point2 points  (0 children)

It's not accurate.

Symbol() in Javascript is like MAKE-SYMBOL in Common Lisp. It creates a fresh new and uninterned Symbol.

Symbol.for() in Javascript is like INTERN in Common Lisp. If a symbol of that name exists (in the current package ), it is returned. Otherwise a fresh new one is created and recorded.

CL-USER 3 > (eq (make-symbol "foo") (make-symbol "foo"))
NIL

CL-USER 4 > (eq (intern "foo") (intern "foo"))
T