Named constructors

aliak something at something.com
Tue Jan 15 02:48:18 UTC 2019


On Monday, 14 January 2019 at 20:59:11 UTC, Steven Schveighoffer 
wrote:
> On 1/14/19 3:05 PM, Jacob Carlborg wrote:
>> On 2019-01-14 15:31, aliak wrote:
>> 
>>> Swift. Named arguments. Overloading. Executed perfectly IMO:
>> 
>> Technically it's not function overloading. The functions have 
>> separate names, the parameter keys are part of the name. 
>> That's at least how it works in Objective-C.
>> 
>
> I was going to say that, but I feel like possibliy in my 
> dealings with Swift (which isn't huge), it may have had more 
> abilities for overloading than objective-C.
>
> -Steve

You can use the same keys with different types and call the 
correct function based on argument type. You can even overload 
based on return type alone!

I don't remember if that was possible in objective-c or not - 
flushed from me system :p


More information about the Digitalmars-d mailing list