When to do optimization?

I think you are kinda both right: we need such legislation, but we also need a plan to enter it gradually.

Because if you would make it possible for the guys who achieved that Boeing 737 MAX fiasco to shift their responsibilities to rustc developers then we wouldn't have any rustc developers in a very short order.

And that's in spite the fact that they are are almost obsessed with robustness and security.

We couldn't expect these types of legislation to be miracles: they they work, but only if you tighten the screws slowly and carefully.

Think about how seat belts were introduced. Something similar should happen with software.

But I don't think it's actually useful to discuss that part here. Some people would do an awful things and some would try to achieve perfection, not matter what you do. Legislation, work culture and other things may change proportions, they are, basically, the question “do we need good software at all?”.

And I think it's pointless to discuss that question on URLO. You can not make language which would make it impossible to write bad software. You can try to make it harder, but… it is impossible to make anything foolproof, because fools are so ingenious.

Rather we should concentrate on the other question: how can we write good software if we decide to do so?. It doesn't matter why people want to write good software, but whether it's legislation or professionalism, or just their inner desire… if they don't know how to do that they would be unable to. Even if you would literally hold the gun to their neck.

And…

if taken literally is quite bad advice. Rather you should do it in steps:

  1. Think about your data structures and think about cost of using them .
  2. Write code and and don't think about its speed.
  3. Optimize code in places where you hit the bottleneck.

Because in practice once a data structure is chosen it's very hard to change it. Sometimes, when advantage of a a better data structure is obvious you can start the herculean effort of rewriting everything… but often than not if the win is “small” (like: mere 5x memory reduction or 2x speedup) and price is high (like: you need to rewrite thousand lines of code to fix anything)… nothing happens.

The most relevant example for URLO is probably rustc itself: it's much slower than it can be… and yet developers can not do anything to significantly speed it up. And these are not a dumb developers by any means.