|
|
|
|
|
by Watabou
3312 days ago
|
|
For Obj-C fans though, named arguments are one of its best features. Yes, more verbose, easy to decipher, and led to great API design. For the first versions of Swift, they actually had two versions. For functions (i.e not functions inside classes), you didn't have to have named arguments for the first parameter, but you did for methods (functions inside classes). They explicitly added it for Swift 3 to make it more consistent with method. I think I like the consistency more, but I do agree "_" is ugly. I don't have an idea of what else they could do though. I don't want Swift to make the parameter names optional, since no one would use it (like in Python, I rarely see named arguments being used) |
|
On a side note, I like the _, it's a clear signal of not caring about something and doesn't take up a lot of visual space.