Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

They aren't even necessarily redundant. If you have argument names as part of the function name, they can be overloaded on - and this is much more readable than type-based overloading because it's all explicit. Swift uses this to great effect, e.g. here are some different ways to construct a string:

   String(repeating: "foo", count: 42);

   String(cString: zeroTerminatedBuffer); 

   String(42, radix: 16);

   String(contentsOfFile: "foo.txt", encoding: .utf8);


Oooh. Nice. I forgot about the Smalltalk / ObjC / Swift usage of keywords for messages.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: