You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
which are all equivalent, but mean something slightly different to the original code, so you'd need to adjust the text slightly.
(None of these solutions feel good enough for inclusion. Maybe you could take a brief tangent to point out the problem with using as? But panicking hasn't been introduced yet…)
The text was updated successfully, but these errors were encountered:
Hi @wizzwizz4 - I've actually had it in the back of my mind to simplify the examples here to just do u8 as char since 1) the point of the examples is to just show why there are different numeric types, and 2) (something) as (something) as (something else) is probably a bit much.
So it'll probably end up with just a u8 as char example here, then move casting to a few sections down with some more advanced examples and discussion. TryFrom could work there (I've forgotten to write about it so far) and I could maybe leverage it into starting to talk about traits before the part about actually implementing them, so still in the relatively simple section but not in the super introductory part on top.
Using the
as
keyword is considered harmful; it silently panics when value are out of range, and it's not explicit about it. Consider replacing:with:
Since this a tutorial, I think it would be better to write:
or:
or:
which are all equivalent, but mean something slightly different to the original code, so you'd need to adjust the text slightly.
(None of these solutions feel good enough for inclusion. Maybe you could take a brief tangent to point out the problem with using
as
? But panicking hasn't been introduced yet…)The text was updated successfully, but these errors were encountered: