Hacker News new | ask | show | jobs
by verelo 3263 days ago
Great point, and for that reason I really like it, but generally my view is: "for most situations, humans are more expensive than the compute costs, so do the thing that is easy for a human to understand and pay the tax on your compute power". Obviously that doesn't always hold true, so place your bets accordingly.
1 comments

Why would it be hard for a human to understand a type declaration using a syntax that has been well established in some of the most popular programming languages (C, C++, Java, C#) for several decades now?
The longer [if based] format can almost be interpreted by any human that has no programming experience but a good grasp of logic, the other is just inherently more complex and less verbose.

Edit: And my point here is basically that less experienced programmers will get it, which makes the barrier to entry lower. Going back to my previous statement, without a better reason, I'd encourage self documenting code and less abstract approaches. This is a pretty mild one, easily looked up...and probably a great thing for people to learn, but still more complex at the end of the day. Language is almost irrelevant here, it's a general statement.

I think you overestimate the readability of C-based syntax in general. A human that has no programming experience would have to start with parsing what !== means (and it's not at all obvious that ! is negation, or why = is doubled), and then move onto &&, although that's slightly more obvious. Nor is "int" obvious as a shortening of "integer" outside of CS - I've seen people interpret it as "internal", for example.

Going further, to even figure out why you need to do all this, that human would need to know such concepts as variables, data types, and nullability. The notion that variables can have designated types is a pretty obvious takeaway from the first two.

Just for fun, if you didn't know what "?int $var = null;" meant, how would you explain that to someone verbally, or better [like most programmers would] how would you search for this online?

Finding the definition of "!==" is easy, simply searching that [including quotes] gives me the answer. Looking for something like "?int =" just gives me useless responses upon first glance.