Comment by tialaramex

16 days ago

"Strongly typed but weakly checked"

It turns out that the machine is much better at the sort of boring mechanical tasks where thoroughness counts and imagination doesn't and so languages which do more, and more, and more checking pay off very well. Rust's borrowck is the obvious first thought today but say WUFFS will check that you've proved certain key properties, WUFFS doesn't need to insert runtime bounds checks for example because you've proved, before the code would compile, that you don't have any bounds misses. You might have proved it by writing bounds checks yourself of course, or likely you have an inherent mathematical rationale for why your algorithm has no misses, but either way the compiler checked your work.

This is something that has irritated me for a long time.

Bounds checks and sized arrays and strings are mechanically very easy to perform by a machine. These are highly automated tasks.

There are some extreme cases where they ruin performance, but in the vast majority of cases they don't matter.

If you look at the type of tasks that cannot be automated, if going from no to full automation required an efficiency loss of 5%, most people would see taking the hit as an obvious choice.

And this is where the problem becomes recursive. You can build a language where the runtime check becomes a compile time check.

We ought to abandon the C paradigm of shifting all the work to the developer and shift more work to the machine.

  • Anyone willing to accept an efficiency loss is already using an interpreted language and doesn’t have this class of problems.

    • > Anyone willing to accept an efficiency loss is already using an interpreted language and doesn’t have this class of problems.

      Linux already takes several of these "efficiency loss" choices in C. The insistence that "actually I never make this mistake" has to be the surest sign that you're not talking to a real engineer across our whole industry. I associate it most with Bjarne Stroustrup, a man who has written a lot of books and papers but no notable software since his "cfront" C++ transpiler decades ago.

      And besides all that, WUFFS isn't even taking an "efficiency loss" - remember it isn't emitting bounds checks it just checks that you proved you don't have bounds misses.