News for hackers. Stuff that matters.
Re:How necessary are var, let, and const? by magice on Monday June 01, 2015 @02:47PM (#9641159)
Hmm, posts like this make me want to make Lisp mandatory for all programmers. Given that LISPers have argued for "lambda the ultimate kitchen utensil/sinks/cooks" for the last few decades, it's slightly annoying that people from other languages repeat the point now. That said, congratulation for learning value of syntactical sugar. I hope you like it.

That said, can somebody implement hygienic macros in JavaScript. They will probably help will people having to explain basics knowledge over and over.

Re:How necessary are var, let, and const? by JadeNB on Monday June 01, 2015 @04:07PM (#9641753)
> Given that LISPers have argued for "lambda the ultimate kitchen utensil/sinks/cooks" for the last few decades, it's slightly annoying that people from other languages repeat the point now.

Why? Are you also annoyed by calculus students who learn ideas today that have been known for hundreds of years?

> That said, congratulation for learning value of syntactical sugar. I hope you like it.

Maybe I am misreading this (it could mean simply what it literally says), but I read it as unconstructive snark.

Re:How necessary are var, let, and const? by kbenson on Monday June 01, 2015 @04:47PM (#9642037)
I suspect that if mathematicians who were creating alternate number systems without calculus were continually learning the usefulness of calculus and telling the world, then yes, those who advised its inclusion for years would be annoyed, if only because it took so damn long and so much time was wasted.
Re:How necessary are var, let, and const? by JadeNB on Monday June 01, 2015 @05:54PM (#9642433)
Assuming that one is a fan of the sort of abstract computer-scientific approach to programming embodied by Lisp (and I am!), then it should be a good thing when people discover it.

Is there a benefit in spreading this discovery to others, even after it's been known so long? Certainly I think so; it's new to everyone at some point, and, since I wasn't originally motivated to read McCarthy's original papers, I wouldn't have discovered the ideas of Lisp without recent expositions of it. Granting the benefit of this, who can better communicate with the unenlightened, in terms familiar to them, than a recent convert? (Although, as braythwayt points out (https://news.ycombinator.com/item?id=9641279), he is scarcely a newcomer to the party.)

Re:How necessary are var, let, and const? by Aloisius on Monday June 01, 2015 @03:32PM (#9641498)
Given that LISPers have argued for "lambda the ultimate kitchen utensil/sinks/cooks" for the last few decades, it's slightly annoying that people from other languages repeat the point now.

Personally I find excessive use of lamdas create unmaintainable and incredibly difficult to debug spaghetti code. The idea that JS developers should make their code even more LISP-like is enough to give me nightmares.

Re:How necessary are var, let, and const? by braythwayt on Wednesday June 03, 2015 @02:44PM (#9654855)
"I used to brag that I could 'write Lisp in any language.' But Lispers doubted that I could, and everyone else feared that I would."
Re:How necessary are var, let, and const? by rayiner on Monday June 01, 2015 @04:39PM (#9641983)
What gets me is that there are languages in 2015 that don't get lexical scoping right. It has been a solved problem for 40 years now.
Re:How necessary are var, let, and const? by pcwalton on Tuesday June 02, 2015 @12:47PM (#9647109)
Saying that it's 2015 is a bit misleading. In JS's case, it's mostly a question of backwards compatibility and interactions with those backwards-compatible features.

The designers of let are largely a bunch of Schemers; they knew what they were doing.

Re:How necessary are var, let, and const? by rayiner on Tuesday June 02, 2015 @06:33PM (#9649476)
I see why my post was confusing. Let me clarify: I was referring to languages like Coffeescript, not let in JS. Though JS got scoping wrong 20 years after it was a solved problem...
Re:How necessary are var, let, and const? by braythwayt on Monday June 01, 2015 @03:03PM (#9641279)
FWIW, I learned Scheme in the mid 1980s, loooooong before I'd ever heard of JavaScript.
Re:How necessary are var, let, and const? by greghendershott on Monday June 01, 2015 @08:08PM (#9643048)
> That said, can somebody implement hygienic macros in JavaScript.

Although I haven't used it hands-on, http://sweetjs.org/ looks impressive.

For example recently sweet.js apparently implemented some cutting-edge Racket macro developments before Racket officially did. :) https://github.com/mozilla/sweet.js/pull/461

Re:How necessary are var, let, and const? by davexunit on Monday June 01, 2015 @04:34PM (#9641949)
Agreed. If JavaScript only had a hygienic macro system I could have written 'let' (and a whole bunch of other forms) for myself a long time ago.