Re: [swift-evolution] Can functions/methods be overloaded on mutability of parameters?

2017-06-03 Thread David Sweeris via swift-evolution

> On Jun 2, 2017, at 22:29, Daryle Walker via swift-evolution 
>  wrote:
> 
> Can I make two overloads such that one can take an argument from a “let”-mode 
> object or a regular function parameter and return an UnsafePointer and then 
> have the other take a “var”-mode object or inout function parameter and 
> return an UnsafeMutablePointer? I think this can be done in C++.

Yeah, I think. Make the "var mode" version take an inout argument. You'll still 
be able to call the "let mode" version with a var, but you can't pass lets as 
an inout parameter.

- Dave Sweeris 
___
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution


[swift-evolution] Can functions/methods be overloaded on mutability of parameters?

2017-06-02 Thread Daryle Walker via swift-evolution
Can I make two overloads such that one can take an argument from a “let”-mode 
object or a regular function parameter and return an UnsafePointer and then 
have the other take a “var”-mode object or inout function parameter and return 
an UnsafeMutablePointer? I think this can be done in C++.

— 
Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT mac DOT com 

___
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution