Hacker Newsnew | past | comments | ask | show | jobs | submit | jeffeld's commentslogin

for (let character...

Please use const. Everything should be const until there is a proven need otherwise.


I reckon there's a kind of broken rationale where people think, "ok well this value will mutate over time so I can't possibly use a const", even though a new block scope is initialized on each iteration. The `for(let i in blah)` idiom is basically cargo-culted now without thought.


It’s funny that you bring up cargo-culting because I find the unflinchingly rigid rule of “const for everything unless the code requires a let/var” to be cargo-cultish. I think it’s proponents vastly overestimate the value that you get out of it. In FE dev mutability is typically an issue at the app state level, and that’s not something you fix with const. It also doesn’t stop objects from being modified, and you shouldn’t make assumptions about what the underlying JS engine does with it as that can change.

Take the code in this article as an example. What danger can there possibly be with using a let when iterating over the set of characters in a word? The inside of the for loop is two lines long. The extra information that using const provides to whoever maintains this code is negligible. Using a const doesn’t hurt, but that level of nitpicking it doesn’t add much value whether in this thread or in code reviews.


It's not about adding value, it's about picking up bad habits from example code.


"An IDE can be a powerful abstraction, but when the underlying layer it's abstracting over becomes inaccessible, then all it's doing is adding more complexity by obscuring concrete details"

This. All day long.


And night, and the whole week.

I can edit, compile and install my kernel and all its drivers in a few command lines from shell, why more and more projects, most way simpler than a kernel, ask me to install for example VSC just to build them? Give me a Makefile and possibly enough instructions to integrate its options into the favorite IDE, but making the IDE a requirement, especially for small projects or those one simply wants to build and install, adds only more complexity.


Microsoft Quick-Help

Circa 1990, a DOS TSR (remember those?) that when you pressed Alt+H (I think) popped up help for the API call at the cursor (usually OS/2 or Win16).


Norton Guides. A similar TSR that also included a compiler for building your own guides. I remember one popular one was the Ralph Brown Interrupt List. I think about this tool a lot, but I think IDE's with auto completion and showing parameters has largely replaced the need. But using NG, still seems faster than having to launch an IDE help system or doing a google search.

https://en.wikipedia.org/wiki/Norton_Guides


Windows has had a kiosk mode since at least XP. It's still there in 8.1 (http://blogs.msdn.com/b/hyperyash/archive/2013/10/25/enable-...).

All the benefits of a managed Windiws installation, and suitable for 99.9% of kiosk requirements. Probably.


Pity Google don't take the hint and make it more readable/understandable then.


It's really not so bad, I'm in no way an angular expert, but reading that passage (even out of context), is not beyond the realms of comprehension.

I think it says what it needs to say in the context of the surrounding information, no more, no less.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: