the.bay.news

Am I overreacting or is byte-based string slicing a huge footgun?

The Rust Programming Language Forum
Am I overreacting or is byte-based string slicing a huge footgun?
I've always considered array indexing the biggest Rust footgun. Since 2015, when I started using Rust, I've felt that arr[i] should either return an Option<T> rather than T or require unsafe Today I learned the hard way that string slicing may be an even bigger footgun, since it operates on byte offsets rather than character positions. I literally panic!ed how many places in my code might be afftected, since I have quite many parsers and other stuff operating on text. What surprised me even mo...

0 comments

Sign in to join the discussion — your thebay.events account works here.

No comments yet.