3 ms·
What I am actually thinking of is this: bytes -> string -> URL -> SQL ... Once you type strings, yo
by mannykannot 11y ago
What I am actually thinking of is this:
bytes -> string
-> URL
-> SQL
...
Once you type strings, you get multiplicities. Completing your diagram, we get
bytes -> string
-> URL-string -> URL
-> SQL-string -> SQL
...
or
bytes -> string
-> URL-string -> URL
-> SQL-string -> SQL
...
There's the redundancy. What are the typed strings doing for us?
Edit: I don't think these diagrams are formally correct - I don't think of URL as a subtype of string, even though it has a string representation and URL objects can be constructed from strings - but I think they make my point clear.
- jasode 11y ago(LATE EDIT: I now see that your responses were influenced by cballard's original examples of NSURL and NSString but I wasn't talking about those.) I was thinking of ASCII/Unicode string types and not the URLString vs SQLString types. Yes, a URLString would be redundant. In C#, the URI data type contains a Utf16 string as a data member but it is not another type of string. We were talking about different things. The ASCII/Unicode string data types would be somewhat analogous to int32/int64/float32/float64/Money data types. The way C# does it is that everything is Utf16 and there is no separate ASCIIString data type for pure ASCII strings. They also don't have pure Utf8 strings. Instead, the UTF16 classes has member "get()/encode()" functions that interpret as ASCII or UTF8. The ASCII/Utf8 data state is transitory. This architectural choice is fine for most apps but if you have 1 gigabyte of ASCII data, it's very memory inefficient to double the memory footprint to 2 GB for Utf16 just to slice & dice strings. If you use byte[] arrays to keep everything as raw ASCII to conserve memory, you don't get any convenient string-like slice & dice functions. The "string type" is lost in a opaque byte[] array.
- mannykannot 11y ago> We were talking about different things. You started by disagreeing with kazinator's objection to typed strings, and for several posts after that you explicitly defended the concept of typed strings. Now you are trying to rewrite the discussion as if it were about the internal representation of strings, which it has never been.
- jasode 11y ago>You started by disagreeing with kazinator's objection to typed strings, You misunderstood our subthread. Kazinator was talking about "fat" strings. I was pointing out that there can be "string types" that helps detect defects. We had 2 different ideas of "string types". I can't say we disagreed insomuch as clarified what each of us was talking about. I also don't care for your accusatory tone as if I'm deceiving people. My examples of string types has been consistent from the very beginning. I was never talking about NSURL/UrlString but you did. I simply didn't pick up on that divergence which was huge. Also, an internal memory representation has ramifications on external semantics. That's not a rewrite. That's been my point all along (see my earlier clipboard example). A sequence of of bytes on disk, or network port, or memory always requires correct semantics to process.
- mannykannot 11y agoKazinator has the last word on what he meant, but his original post, which is short, clear, and to-the-point, contains no such qualifications.
- jasode 11y agoHe qualified it with the Alan Perlis epigram: "The string is a stark data structure and everywhere it is passed there is much duplication of process. It is a perfect vehicle for hiding information." My "string type" examples to help uncover defects in parsing & yanking were not relevant to Alan Perlis criticisms. The "hiding information" of strings is an orthogonal issue.
- mannykannot 11y agoGiven that Kazinator's post is in reply to one that specifically gives NSString vs. NSURL as an example, and you were making a point that you say does not apply to that example, then the onus was on you to make it clear that you were going off on a tangent. >My "string type" examples to help uncover defects in parsing & yanking were not relevant to Alan Perlis criticisms. Did you mean to write that Alan Perlis' criticisms were not relevant to your examples? Anyway, this should perhaps have brought it to your attention that you were going off on a tangent, given that Kazinator chose to qualify his point with this quote.