Re:Destroy All Ifs – A Perspective from Functional Programming
by steveklabnik on Sunday July 17, 2016 @12:30PM
(#12110680)
If `to_string` was a function that was imported into the local namespace, you could. But since it's a method, you can't; you need to provide the trait name.
[ Parent
| on HN ]
Re:Destroy All Ifs – A Perspective from Functional Programming
by dan00 on Monday July 18, 2016 @04:46AM
(#12113888)
If there's a function and a method named to_string the user
would've to be explicit about which one he uses by adding a
namespace, like ToString.
If there's only one to_string function or method, the compiler could just take this one.
Re:Destroy All Ifs – A Perspective from Functional Programming
by steveklabnik on Sunday July 17, 2016 @02:47PM
(#12111226)
To follow up on this slightly, it's not really that this is special syntax. It's that map_err takes a function as an argument, and this is how you refer to this method by name.