5 ms·
I'm learning it now, and although nothing is confusing me yet, the un-named first argument to each method is a pretty amazing wart. The designers never saw "nam
by iron_ball 16y ago
I'm learning it now, and although nothing is confusing me yet, the un-named first argument to each method is a pretty amazing wart. The designers never saw "nameOfMethodWithFirstArgument:(Type )arg1 secondArgument:(Type )arg2" and decided to rethink things? Why not?
- yan 16y agoHow would you design it?
- iron_ball 16y agoMaybe I'm missing something obvious, but why not nameOfMethod: firstArgName(Type '')arg1 secondArgName(Type )arg2? So you'd get invocations like this: point = createPoint: x:10 y:15; Instead of this: point = createPointWithX:10 y:15; edit: no idea how to get asterisks to appear, so pretend I have pointer symbols where appropriate.
- MWinther 16y agoYou can go unnamed for all your arguments, no need to feel the first one is being left out. [object method:1 :2 :3] is valid. =) On the other hand, Objective-C encourages verbosity, and in well-defined methods, I have a hard time considering calling the first argument unnamed.