News for hackers. Stuff that matters.
Re:Show HN: Nothing.js – A chainable mock object which alway... by bluepnume on Saturday March 31, 2018 @06:03PM (#16725402)
One thing I've been finding increasingly while using Flow in javascript is, null-pointer exceptions aren't really much of a problem any more.

Where they might have caused a bug, 90% of the time Flow will catch them, and insist that I do a null check and handle that case.

And when they do crop up, it's usually more of a serious failure that I'm happy to trigger an exception early, rather than having it propagate further down the stack by using something like nothing.js. Especially given the list of gotchas. The fact that `Nothing` is not falsy is really problematic.

I'm pretty convinced at this point that `a && a.b && a.b.c && a.b.c.d` is an anti-pattern in javascript anyway; if I'm that unsure about the structure of my data, I have more serious problems than just trying to avoid null pointers.

Re:Show HN: Nothing.js – A chainable mock object which alway... by lojack on Saturday March 31, 2018 @09:35PM (#16726206)
Usually things of form `a && a.b && a.b.c && a.b.c.d` are a sign of a law of demeter violation. This applies to more than javascript. I view code like this as a sign that there might be a better way, as opposed to a stedfast rule. Refactoring to remove these types of violations tends to lead to better code.
Re:Show HN: Nothing.js – A chainable mock object which alway... by grincraft on Sunday April 01, 2018 @06:59AM (#16727688)
Law of demeter applies to code, but in JS the deep property access is actually done often against data (deserialized JSON).
Re:Show HN: Nothing.js – A chainable mock object which alway... by daddosi on Saturday March 31, 2018 @11:08PM (#16726482)
Just use try{} and keep the secret.