HNHacker News
TopNewBestAskShowJobs

rnd33

250 karma · joined October 26, 2013

submissionscomments
rnd33··on Javascript patterns
Yes, a function definition is hoisted too but its implementation is always hoisted together with its declaration, preventing some bugs caused by variable hoisting.

I made an example here: http://pastebin.com/2nS9EDPb

(Please correct me if I'm wrong, I wasn't aware for example that function declarations were treated as variables, redefinable etc)

rnd33··on Javascript patterns
Sure, but the solution should not be "semicolon everywhere" but rather "semicolon where necessary", where necessary also includes places that can produce ambiguities depending on the code directly following (or after minification). Omitting a semicolon after a function declaration will never produce ambiguous code.

What I'm still arguing for is that "enforcing semicolon habits" is not a compelling argument for using function expressions over function declarations. (Perhaps you're talking about semicolons in general, which is something I would rather not get into :)

rnd33··on Javascript patterns
Regarding function declarations, it considers function declarations to be an antipattern and advises you to instead use function expressions at all times (https://github.com/shichuan/javascript-patterns/blob/master/...).

I'm really skeptical about this. Using function expressions has some quite subtle consequences (hoisting, accidental/unintended closures) which you automatically avoid when using function declarations. Function declarations are also very useful since they allow you to use the function before it is defined (in the code), which mean you can read the code (and use the function name as an abstraction) without having to scroll past all function implementations.

To expand a bit on the accidental closures part, a variable bound by a closure is an implicit dependency of that function. By breaking function expressions out as function declarations you can be more explicit about what kind of input that piece of code needs from the outside. I just think overuse (nesting etc.) of closures can lead to some quite messy code, it gets harder to reason about when a variable was actually bound and to what.

rnd33··on Computer Science Interview Questions with C++ Solutions
I don't understand this attitude. There must be lots of great companies to work at where the interview process is a bit flawed and the questions a bit unrealistic. Why let that stop you? Why handicap yourself when you can just learn it?
rnd33··on Show HN: I mapped US medical prices. Save thousands by driving a few miles
And people in America stating that healthcare is not free is a rant-trigger for me.

Everyone here knows that it's not "free" but subsidised by taxes. That's what "free" means when talking about healthcare, free at the point of service, and free as equally available to everyone.

How else would it work? Are the doctors without pay and with no equipment?

rnd33··on Entangled toy universe shows time may be an illusion
Because time has a direction (for some reason it doesn't seem possible to go backwards though), and a value. I can't think of similar analogies for 'thought' that makes it fit with the other 3 room dimensions.
← PreviousPage 3 of 3