←back to thread

1371 points yett | 1 comments | | HN request time: 0.207s | source
Show context
pmarreck ◴[] No.43774498[source]
My takeaway, speaking as someone who leans towards functional programming and immutability, is "this is yet another example of a mutability problem that could never happen in a functional context"

(so, for example, this bug would have never been created by Rust unless it was deeply misused)

replies(8): >>43774636 #>>43774657 #>>43774734 #>>43774921 #>>43775019 #>>43775231 #>>43775948 #>>43780177 #
jdndndb ◴[] No.43774734[source]
Could you elaborate? I cannot see how a functional programming language would have protected you from reading a non existing value while not providing a default
replies(3): >>43775498 #>>43780255 #>>43780979 #
1. pjc50 ◴[] No.43780979[source]
It simply would not have allowed you to write code which did that. And you wouldn't have a function like sscanf() either. You'd probably end up with a much more normal looking parser function that returned a value-or-error type.