6 ms·
This is a lot like how in JavaScript you have footguns like the with statement or in Python 2 where you have Unicode issues, etc. I am sure we could definitely
by IgorPartola 6y ago
This is a lot like how in JavaScript you have footguns like the with statement or in Python 2 where you have Unicode issues, etc. I am sure we could definitely a new C standard that excludes these functions as obsolete, but the linked header file is a pretty sensible interim solution. C is an old language and it’s kind of amazing that code written 30 years ago can still by and large be compiled by a modern compiler. Ever try to run 3 year old React projects using today’s React? :)
- ggregoire 6y ago> in JavaScript you have footguns like the with statement I've been coding in JS on a daily basis for more than 10 years and today I learned there is a `with` statement in JS. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/with https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe... Edit: well, seems like it's been deprecated/forbidden since ES5 (2009), so it makes sense I've never seen it.
- GordonS 6y agoAnd me around 20 years - also never even heard of the `with` statement! I think to qualify as a footgun, people actually need to be using it in the real world.
- javbit 6y agoIt should be called something like appendixgun then because you don't use it but it still has a chance of causing needless suffering and pain.
- astrange 6y agoThe appendix is a reservoir of gut bacteria in case you lose yours in an infection or by taking too many antibiotics.
- IgorPartola 6y agoI have seen it in the wild. I first learned of it from Douglas Crockford’s JavaScript the good parts. He also had some things to say about the new keyword and prototype inheritance and how we should stop using them. Ironically while he was dismissed on that suggestion then, VueJS has pretty much implemented exactly what he has in mind in their V3.
- azernik 6y agoThere are lots of more conventional footguns in JS, though - everything about the Date object/class, for example.
- bsimpson 6y agoWas also popular in ActionScript, the JS cousin that powered dynamic Flash content: with (myShape.graphics) { beginPath(); setFill(0xFF0000); moveTo(6, 9); // ... }
- UncleMeat 6y agoAn old grad school connection of mine wrote a formal semantics for ES5 and couldn't explain what "with" did in words.
- viklove 6y agoIt amuses me that HN hates JS so much, that even a topic about problems with C turns into a JS-bashing thread. Also, I just want to remind you that JS isn't just React. There are plenty of libraries written in C that introduce breaking changes over the course of 3 years. Nothing will stop people from finding ways to complain about JS though, I know. The hate-boner is very real.
- sadgrip 6y agoI think in most cases it's probably not hate but a deep, deep love.
- jrimbault 6y agoJavaScript, LISP under C disguise. No wonder it's "popular" on HN. Assorted musing : Rust, OCaml under C disguise.
- orwin 6y agoI think most people on HN like Javascript, or at least its idea? I mean, its a very C-like functionnal language, especially since ES6 put Js on the right road (for me at least)?
- IgorPartola 6y agoIt looks similar, but it isn’t. You can’t blow your stack in JavaScript while in C that’s practically a language feature and a design goal.
- lliamander 6y agoI appreciate Javascript's LISPy qualities, but it has an inordinate number of footguns and a relative lack of standard, stable libraries. Coming from languages like Java and Erlang that are relatively scrupulous about such things is a bit jarring. I do like Typescript though, as it adds some really nice ergonomics.
- GordonS 6y agoI've been a long-time Javascript hater. Probably didn't help that I started out 20 years ago, and dealing with cross-browser support was a big issue. And of course, let's so no more about Internet Explorer shudder. And then NPM - a direct result of JavaScript's anaemic standard library. Anyway, things have changed a lot, and I recently worked on my first ever web app with native ES6 - no transpiling to ES5! It was... not nearly as bad as it used to be! Modules are a thing, and the language has evolved with things like async/await, evolved for the better, I think. The standard library is still horribly anaemic though - the number of "helper" functions needed is ridiculous. But still, I would no longer classify myself as a hater. Progress at last :)
- detaro 6y agoBecause individual libraries choosing to change quickly is comparable to language stability how? The relevant comparison would be "run a 3y old react app (or a 20 year old website using JS) in a modern browser or interpreter"
- _the_inflator 6y agoYes, and it would still run fine I guess. I think only eval() changed over time. APIs and so on are still the same except for some Netscape stuff.
- IgorPartola 6y agoInsofar as stdlib for C is a library, I think it’s not the worst comparison.