allowed: if (!isAdmin) return; if (failedAssertion) throw new Error(reason); if (!x) x = 1; 2/
with paren-free and getters and more targeted lints, that could have been: if foo.isValid return; Which seems fine for guards
-
-
the case of the "then" part being just 'return;' is indeed special: easy to read even when skimming.
-
the two special cases imo are `return` and simple throws (I abstract complex throws when used in guards to keep 'em shirt)
-
I like forcing return to be on next line because I see all exit points when scanning vertically
-
Especially useful when there is no highlighting, like in diffs
-
Both GitHub and Phabricator highlight syntax in diffs, right?
-
GitHub since a few months ago yea. But not my local git diff which is where I review own code.

-
the nice thing about Ruby tail guards is you can scan the front: def f(b) return if b.valid? end
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.