News for hackers. Stuff that matters.
Re:String types in Rust by brinker on Monday March 28, 2016 @04:36PM (#11377173)
Hey, author here! Happy to answer any questions people have, and happy to hear any feedback.
Re:String types in Rust by nothrabannosir on Monday March 28, 2016 @11:31PM (#11379308)
String (the “owned” sort of string type) is a wrapper for a heap-allocated buffer of unicode bytes. str (the “slice” sort of string type) is a buffer of unicode bytes that may be on the stack, on the heap, or in the program memory itself.

"unicode bytes" aren't a thing; bytes implies encoding (and subscripting yielding <=0xff), otherwise it's "codepoints" (and subscripting yielding an int somewhere on the unicode planes).

Further down:

String and str are guaranteed to be valid UTF-8 encoded Unicode strings. If you’re wondering why UTF-8 is the standard encoding for Rust strings, check out the Rust FAQ’s answer to that question.

That's spot on. Please add this to the first part, too; "... buffer of UTF-8 encoded unicode bytes". or even just "encoded unicode string." It will be clear what is (and is not) meant.

Otherwise nice article! Even understandable for someone with no Rust experience.

Re:String types in Rust by brinker on Tuesday March 29, 2016 @10:33AM (#11381711)
Sure, no problem.

As a kinda funny aside, I also wrote the linked-to FAQ answer. Took a number of drafts to get all the fiddly Unicode terminology right.

Re:String types in Rust by imron on Monday March 28, 2016 @05:09PM (#11377412)
Maybe consider a word other than 'sort'.

When I see 'sort' collocated with 'string' my mind immediately jumps to the verb meaning of 'sort', not the noun meaning of 'sort', so it was a bit confusing.

Re:String types in Rust by rkangel on Tuesday March 29, 2016 @06:21AM (#11380530)
Yes I had that too. I would have used "variety", as in this "variety" of string. Or "kind" maybe.
Re:String types in Rust by llogiq on Monday March 28, 2016 @05:23PM (#11377514)
Yeah, the word you look for isn't "sort", but "kind".
Re:String types in Rust by brinker on Monday March 28, 2016 @06:10PM (#11377817)
I shied away from the word "kind" simply because that has a specific meaning in type theory that doesn't fit here. Higher-kinded types are a must-requested feature for Rust, and I didn't want to confuse readers into thinking this has some connection to Rust's string types.
Re:String types in Rust by kibwen on Monday March 28, 2016 @09:07PM (#11378835)
The word "sort" isn't free of alternate associations either, and "kind" seems less likely to confuse people, seeing as Rust doesn't have any concept called "kinds" right now and won't have HKT for years, if ever.
Re:String types in Rust by lmm on Tuesday March 29, 2016 @07:35AM (#11380741)
"sort" also has a specific meaning in type theory - it's a class of kinds.

Also the type-theoretic meaning of "kind" is accurate here, no? Owned vs slice really are two different kinds - it's just that Rust can't represent kindedness in general (it has specialized support for tracking ownedness, but you can't reuse that system to track other properties).