3 ms·
> in Rust... The extra complexity of such an API meant that this proposal was never really taken seriously, In fact it looks like even standard indexes have be
by bluejekyll 10y ago
> in Rust... The extra complexity of such an API meant that this proposal was never really taken seriously,
In fact it looks like even standard indexes have been deprecated, in favor of Iterators over the string:
https://doc.rust-lang.org/stable/std/primitive.str.html#method.char_at https://doc.rust-lang.org/stable/std/primitive.str.html#meth...
Iteration is better IMO.
- johncolanduoni 10y agoMakes a lot of sense. I get frustrated with how explicit I have to be with Rust sometimes (currently I'm writing something with a lot of reusable, immutable structures and am put off by how much Rc.clone() that requires) but making it known to the programmer that every indexing of a String is effectively an iteration is a good call.
- bluejekyll 10y agoYeah, this is a tough thing when coming from other languages. I've been using references pretty effectively to get around some issues like this, though in other cases Rc is my only resort. If you have some code up on github, I'd be happy to take a look and see if there's some other options that are less cumbersome.