3 ms·
That feels like part of why some juniors are so confident while more senior engineers are plagued with self-doubt. Juniors know how much they have learned wher
by ericmcer 11mo ago
That feels like part of why some juniors are so confident while more senior engineers are plagued with self-doubt.
Juniors know how much they have learned whereas a 10+ year senior (like the author) forget most people don't know all this stuff intuitively.
I still will say stuff like "yeah it's just a string" forgetting everyone else thinks a "string" is a bit of thread/cord.
- kragen 11mo agoI forget that people think strings are different from sequences of bytes.
- sfink 11mo agoI didn't know that at some point, then I knew that and found it obvious, and now I don't know it again. Strings are very very not sequences of bytes. Strings are a semantic thing. There may be a sequence of bytes in some representation of a particular string, but even then those bytes are not enough to define a string without other stuff. An encoding, at the very least. But even then, there are many things that could be described as a "string". A sequence of code points, perhaps? Or scalar values? Grapheme clusters? Not to mention that you may not even have a linear sequence of bytes at the bottom level. You might have a rope (cons cell), or an intern pointer, or...
- kragen 11mo ago[flagged]
- kragen 10mo ago(Reposting because original comment was "flagged".) This is a profoundly stupid kind of argument. There isn't even an objective truth you could conceivably convince someone of. There's just how you're choosing to use the word in conflict with a preexisting convention, which marks you as part of some social group, just like "this slaps", "skibidi", "rad", or "whenever". The preexisting convention isn't some apprehension of objective truth either. It's just an arbitrary tradition, like the meaning of any word. People who are using the word in the older sense are usually not mistaken. At worst, they're your political enemies, but often they aren't even that; they just have experiences you don't. Attempting to persuade them, as you are doing, can only have the effect of further narrowing your intellectual horizons—even in the unlikely case that you are successful, but especially in the far more common case where they try to avoid you after that. I recommend more curiosity and less crusading. (In the rare case where someone is mistaken, it's sufficient to say "I meant a Unicode string" or "but we're iterating over codepoints, not bytes," but such mere clarification is not what you're up to.)
- BitsAndObjects 11mo agoCheck out both how Python strings are implemented and the string type’s semantics in the language. Strings are sequences of bytes only in the sense that everything stored in memory is a sequence of bytes. The semantics matter far more, and they aren’t the same as a sequence of bytes. Also many languages make strings immutable and byte arrays mutable.
- kragen 11mo agoI think it's bad to attempt to redefine an established term in this way, but anyway people who use that established definition are not merely fools who lack your wisdom; see https://news.ycombinator.com/item?id=46086919 https://news.ycombinator.com/item?id=46086919.
- BitsAndObjects 11mo ago> I recommend more curiosity and less crusading. That is wonderfully ironic. Anyway, coming from a C background, sure, strings are kind of just sequences of bytes. For people coming from other backgrounds, they'll have different understandings of what a string is (probably more based on semantics of the language they learnt first than on the underlying representation in memory). I'm not trying to persuade you of one definition or another. Nor am I redefining the meaning of a string, as it's clearly subjective by background and/or by context. To that end, take my point as merely "you need to know the context", and I happen to believe the context that matters is the semantics of the programming language you're using (as opposed to the underlying representation of an instance of the type in memory). My comments are also for the benefit of the many folks (particularly junior members of our community) that perhaps don't have exposure to this way of looking at things.
- lawn 11mo agoI mean, all data is just binary in the end. In most programming languages strings contains more semantics than just sequences of bytes. For example in Rust all Strings are utf-8, so Rust strings are binary sequences but not all binary sequences can be Rust strings.
- mjd 10mo agoI had an interesting conversation with someone many years ago, possibly Brent Yorgey. We were thinking of arrays in quite different ways. To me, it was a data structure, with a specific memory layout: a contiguous block of memory containing a sequence of objects of all of the same size, specifically to support constant-time indexing. To him, it was an API, a mapping from non-negative numbers to values, and the underlying implementation could have been a hash table or whatever. I think we're seeing a similar disconnect here. Some people think a string is a contiguous block of bytes, perhaps with a sentinel value on the end (C string) or a fixed-size count on the front. Others think of it as an API for storing text. These used to overlap, but in recent decades they have diverged substantially. The argument here is about the meaning of the word, not the technical reality of the thing it refers to, so it has no objective resolution.
- aorloff 11mo agoWell coached juniors run through brick walls
- TeMPOraL 11mo agoScrapping them off the wall is not pleasant, though. But throw enough of them at it, I guess the wall eventually goes down too.