Re:Leaky Abstractions
by chii on Wednesday June 02, 2021 @11:12PM
(#27376842)
i wouldn't call floating point numbers an abstraction on real numbers. It's a representation - like char[] is a representation of strings, which is itself an abstraction used to manipulate human readable text!
[ Parent
| on HN ]
Re:Leaky Abstractions
by an1sotropy on Thursday June 03, 2021 @02:10PM
(#27385175)
Read the link above about FP as a leaky abstraction of the reals; it explains it better than I can. FP is not really a representation of reals, because you can't represent the entire number line with a finite number of bits. It is a representation of a cleverly chosen subset of the reals, so well-designed that many people forget that they're not dealing with real numbers. That intelligent people can write code with FP values, operating on them thinking they are real numbers, and not knowing how FP works, and get programs that often do nearly the right thing, speaks to the success of FP as an abstraction. Understanding how things can go wrong is the leaks (like, non-associativity). I don't think people manipulating char[] representations of strings are ever at risk of forgetting that it's just an array of chars (they program with full awareness of the implementation), so it doesn't feel like there's much abstraction happening there. Other higher-level data structures for text manipulation probably do implement some useful abstractions; I haven't worked with those.
> I don't think people manipulating char[] representations of strings are ever at risk of forgetting that it's just an array of chars
and yet, when people start adding unicode text under this representation, and the program fails to work properly. Or when counting characters, and assume the glyph count would match the char array length.
or any number of other string issues.
Re:Leaky Abstractions
by an1sotropy on Friday June 04, 2021 @11:22AM
(#27394485)
yea good point. Unicode does overwhelm simplistic ideas about string representation. Love those grapheme clusters.