Re:Classes are Expressions
by serve_yay on Thursday June 04, 2015 @04:21PM
(#9661785)
I don't understand why you're talking about this like yours is the normal way and his isn't, or something. Symbols are "real" too.
[ Parent
| on HN ]
The closure-based solution has been around for a long time; the symbol-based approach is new.
My reaction to the article's approach was largely: okay, cool, this seems approximately as good as the closure-based solution; is there any reason for me to switch? Or is this just a cool toy example to show off classes-as-expressions?
It's not new in the some other language worlds, where your approach is also not new - I mean "make-symbol" in Common Lisp...
Btw, once a symbol is created, is it ever garbage collected? (They are not in Common Lisp for example).
Possibly on page reload (for javascript in browser) they would. But how about long-running javascript code?
Okay, some better phrasing, then: the closure-based approach has been idiomatic for years, but the symbol-based idiom is new.
What lessons have folks learned from trying these approaches in other languages? Which is more idiomatic, and why?