← Back to context

Comment by imtringued

16 days ago

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.