Closed paholg closed 5 months ago
You have a better name for try_cast_raw
? I tend to try to keep _raw
for internal API or some really advanced API...
Fair enough. If I could go back in time, I would propose this function be try_cast
and the one that returns an option be renamed or removed, but that is not worth a breaking change.
I can't think of a great name. Maybe try_cast_res
or try_cast_result
?
Picking a good name is important for an API, just for that reason you just mentioned -- we can never ever change it.
Let's spend a couple more days thinking up new names... there is no rush until the next release anyway...
I also think try_cast_result
looks reasonable...
I have updated the name to try_cast_result
.
Alright let's merge this.
This function is useful for error-reporting. With
try_cast
, one has to do one of the following:Dynamic
.Dynamic::is
first, and still handle theNone
case oftry_cast
.