@whitequark borrow worries me because many uses of an index stop working with a borrow. For example, what if you want two indices so you can interate over the string twice. Ofc the index idea only works if you can prevent the string from being mutated…

Follow

@mcc What do you mean by index here? I'd guess you mean an usize that you use to index into the string, but that doesn't contain any references.

@robryk I mean the abstract data type of an index. An entity, potentially opaque, that can be used as an internal pointer into the string.

@robryk But it would be nice if I could do at least some arithmetic on the potentially opaque object (doesn't have to be through default operators), such as comparison or incrementing.

Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.