HackerTrans
TopNewTrendsCommentsPastAskShowJobs

balfebs

no profile record

comments

balfebs
·3 years ago·discuss
Not sure what you mean, but ternaries are right-associative in Perl just like most other languages. PHP is the odd one out.
balfebs
·3 years ago·discuss
I believe that 9,000 years ago there wasn’t as distinct a pole star due to axial procession. Celestial north would probably have been somewhere between Vega and Tau Hercluis with a fairly wide separation.
balfebs
·3 years ago·discuss
Unfortunate that the repo name and header text of the README both misspell “programming”
balfebs
·3 years ago·discuss
If you define fall as the size of the gap. You could also take it as acceleration towards the barycenter, which would be the same. These are indistinguishable for everyday objects so could argue that the word “fall” could be interpreted either way.
balfebs
·4 years ago·discuss
That is a concern, but this makes invariants something the compiler can reason about more easily, since they happen at function boundaries and are distinct from regular code, unlike “vanilla” assertions.
balfebs
·4 years ago·discuss
The post assertions do look very similar to a unit test, but the pre assertions seem really useful; it can sometimes be difficult to know every code path that leads to your function, and though tools exist for this, assertions on inputs help you catch errors arising from unusual conditions.

This seems like it’s mostly syntactic sugar for assertions, keeping them at the interfaces of the function (in and out).

It can also be sometimes useful to have these conditions right there alongside the implementation and not just somewhere else in your unit tests.