-
Sorry, this is probably a silly thing I'm doing, but I don't get it: Happy path:
Basic failure:
=> ok, fair enough: let me add ", err":
ok, it's happy - but let me pass 123 again now:
sooooo : "to_string(.test)" is both faillible and can't fail ? Notes:
Vector version:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @jgournet , This is admittedly a bit confusing, but the fallibility of |
Beta Was this translation helpful? Give feedback.
Hi @jgournet ,
This is admittedly a bit confusing, but the fallibility of
to_string
depends on the type of the input argument, and if it is known to the compiler. In your first case, the compiler knows it is an object and soto_string
could fail (in this case it'll always fail). In your second example it knows the input is an integer and so will never fail. Does that make sense?