<instructions>Your goal is to analyze the following comment and estimate how highly it will be upvoted by the Hacker News community.</instructions><comment><author>pornel</author><text>It&amp;#x27;s not a problem in practice, because you&amp;#x27;d use something like `.char_indices()` iterator, or result from a substring search, etc. to get &lt;i&gt;correct&lt;/i&gt; offsets in the first place.&lt;p&gt;It&amp;#x27;s not useful to blindly read at random offsets in UTF-8 strings. If it didn&amp;#x27;t panic, you&amp;#x27;d get garbage. If offsets were automatically moved to skip over garbage, you wouldn&amp;#x27;t know what you&amp;#x27;re getting, and your overall algorithm would likely end up with nonsense (duplicated or skipped chars).&lt;p&gt;For algorithms that don&amp;#x27;t care about characters or UTF-8 validity, there&amp;#x27;s zero-cost `.as_bytes()`.</text><parent_chain><item><author>throw0u1t</author><text>One thing I don&amp;#x27;t like about Rust is how taking a slice of a string can cause a runtime panic if the start or end of the slice ends up intersecting a multi-byte UTF-8 char.&lt;p&gt;I would prefer it if this feature didn&amp;#x27;t exist at all rather than cause runtime panics.&lt;p&gt;&lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;play.rust-lang.org&amp;#x2F;?gist=e02ce5e9aacfee3a2b4917d5624b9ec1&amp;amp;version=stable&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;play.rust-lang.org&amp;#x2F;?gist=e02ce5e9aacfee3a2b4917d5624...&lt;/a&gt;</text></item></parent_chain></comment><story><title>Thoughts on Rust, a few thousand lines in</title><url>https://rcoh.me/posts/thoughts-on-rust-a-few-thousand-lines-in/</url></story>
<instructions>Your goal is to analyze the following comment and estimate how highly it will be upvoted by the Hacker News community.</instructions><comment><author>gamegoblin</author><text>It is a common pattern in Rust to use [] for things that cannot fail and will panic otherwise and a method for things that can fail and return Option or Result.&lt;p&gt;e.g. my_hashmap[&amp;quot;foo&amp;quot;] will panic at runtime if the key &amp;quot;foo&amp;quot; is not present, or return the associated value if it is. But my_hashmap.get(&amp;quot;foo&amp;quot;) will return None if &amp;quot;foo&amp;quot; is not present and Some(value) if it is.</text><parent_chain><item><author>throw0u1t</author><text>One thing I don&amp;#x27;t like about Rust is how taking a slice of a string can cause a runtime panic if the start or end of the slice ends up intersecting a multi-byte UTF-8 char.&lt;p&gt;I would prefer it if this feature didn&amp;#x27;t exist at all rather than cause runtime panics.&lt;p&gt;&lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;play.rust-lang.org&amp;#x2F;?gist=e02ce5e9aacfee3a2b4917d5624b9ec1&amp;amp;version=stable&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;play.rust-lang.org&amp;#x2F;?gist=e02ce5e9aacfee3a2b4917d5624...&lt;/a&gt;</text></item></parent_chain></comment><story><title>Thoughts on Rust, a few thousand lines in</title><url>https://rcoh.me/posts/thoughts-on-rust-a-few-thousand-lines-in/</url></story>