←back to thread

1371 points yett | 5 comments | | HN request time: 0.847s | source
Show context
amenghra ◴[] No.43774928[source]
IMHO, if something isn’t part of the contract, it should be randomized. Eg if iteration order of maps isn’t guaranteed in your language, then your language should go out of its way to randomize it. Otherwise, you end up with brittle code: code that works fine until it doesn’t.
replies(11): >>43774993 #>>43775199 #>>43775210 #>>43775344 #>>43775361 #>>43775510 #>>43775759 #>>43776084 #>>43776311 #>>43776598 #>>43778608 #
tantalor ◴[] No.43776598[source]
Nope. You have to remember https://www.hyrumslaw.com/

  With a sufficient number of users of an API,
  it does not matter what you promise in the contract:
  all observable behaviors of your system
  will be depended on by somebody.
If you promise randomization, then somebody will depend on that :)

And then you can never remove it!

replies(2): >>43778253 #>>43780617 #
1. timewizard ◴[] No.43778253[source]
> If you promise randomization

You don't. You say the order is undefined.

replies(2): >>43778894 #>>43778928 #
2. dwattttt ◴[] No.43778894[source]
You can randomly not randomise it :)
3. __float ◴[] No.43778928[source]
That isn't the point. In practice, if you provide randomness, it will be depended upon.
replies(1): >>43779002 #
4. psnehanshu ◴[] No.43779002[source]
Why is that? Is that just bad coding habits?
replies(1): >>43779871 #
5. simonask ◴[] No.43779871{3}[source]
All of this is bad coding habits. That's why we're here.