[swift-evolution] Implicit conversion between primitive types

Milos Jakovljevic milos1290 at gmail.com
Sat Feb 18 07:23:41 CST 2017


Are there are any plans of adding implicit conversion between primitive types?

For example

var float = 5.0

func accept(float: Float) {
    print("this is \(float)")
}

This will raise a warning that double cannot be cast to float. Which is really frustrating since i always have to add type explicitly or cast it to Float. 

I would also like to propose to add "f" modifier for floats.
Any thoughts?

Best,
Milos Jakovljevic


More information about the swift-evolution mailing list