Live data from Hacker News

Programmers should never trust anyone, not even themselves

carbon-steel.github.io

1–10 of 163 posts

Re: Programmers should never trust anyone, not even themselves

#4
>> Random access of a character in a text buffer could take constant time (for ASCII) or linear time (for UTF-8) depending on the character encoding

This is true, but incomplete. All unicode encodings take linear time, not just utf-8.

That's because a character can contain multiple code points. Utf-32 allows for random access of code points in constant time, but not characters.

Utf-16 has variable length code points so it is the same as utf-8 in that regard.

Re: Programmers should never trust anyone, not even themselves

#5
post #4

>> Random access of a character in a text buffer could take constant time (for ASCII) or linear time (for UTF-8) depending on the character encoding This is true, but incomplete. All unicode encodings take linear time, not just utf-8. That's because a character can contain multiple code points. Utf-32 allows for random access of code points in constant time, but not characters. Utf-16 has variable length code points…

Yeah, but the author was talking about ASCII. ASCII takes constant time.

Re: Programmers should never trust anyone, not even themselves

#8
post #7

But then you say "trust, but verify" in the post.

trust but verify translates to trust no one but don't be a dick about it

To me, it's rather a postcondition instead of precondition.

Trust that a person will do the right thing, but verify that the right thing has actually been done.

Re: Programmers should never trust anyone, not even themselves

#10
> In reality, the bank does not just store the money we deposit. It loans away/invests most of the money that people deposit. Our money does not sit idle in a large pile in a vault.

Nope. In reality the money doesn't exist. Amazing how many people think that somewhere a cartload of money is physically moving every month when they get paid. When was the last time you deposited anything in a bank? The abstraction is even higher than that. It's just numbers in a computer system. The abstractions work because banks are "too big to fail".

Post reply on HN