Should default values be prohibited here?
infix operator **
func **(num: Double = 1, n: Double = 2) -> Double {
pow(num, n)
}
or should they work? Straw man syntax:
123.4 ** default
Should default values be prohibited here?
infix operator **
func **(num: Double = 1, n: Double = 2) -> Double {
pow(num, n)
}
or should they work? Straw man syntax:
123.4 ** default
let x = (**)(5)
That is weird. I didn't think it was possible to cast a function with defaults to a closure that leaves off any arguments. E.g.
(**) as (_, _) -> _ // compiles
(**) as (_) -> _ // doesn't
Any idea why it works here?
And how about getting the default for the first argument, rather than the second? Impossible?