Implicit conversions


Are there plans to implement implicit conversions like in Scala?

For example, if I define following implicit function:

implicit def Double2Complex(value : Double) = new Complex(value, 0.0)

Then I can pass double values to any function that accepts only Complex, because the compiler converts the double value implictly to Complex. This makes programming more comfortable and you have less boiler plate code.

But – if I remember correctly – this also increases compile time in Scala.

What do you think of this feature?


We have the Into trait for things like this. Instead of having a function that only accepts Complex and an implicit conversion function, you can instead write a function that takes Into<Complex>, which may apply for both Complex and Double.

Rust wants to be a system language, and as such it has to be explicit about cost.


Or AsRef<Path> which is used very frequently in the stdlib. To great effect, in my opinion, since str impls AsRef<Path>. Meaning you can pass string literals to most functions that deal with paths.