4 ms·
The '*' and '/' in function parameter lists for positional/keyword arguments look particularly ugly and unintuitive to me. More magic symbols to memorize or loo
by Razengan 7y ago
The '*' and '/' in function parameter lists for positional/keyword arguments look particularly ugly and unintuitive to me. More magic symbols to memorize or look up.
- riffraff 7y agoI also cannot honestly think of a case where I want that behaviour. The "pow" example looks more like a case where the C side should be fixed.
- yxhuvud 7y agoOr where the method should be exposed into several different methods.
- masklinn 7y ago> I also cannot honestly think of a case where I want that behaviour. There's plenty of situations where a named argument does not help, and encoding it can only hurt. It makes little to no sense to name the first argument to `dict.update` for instance. Or the argument to `ord`. That, incidentally, is why Swift added support for positional-only parameters (though it has no concept of keyword-or-positional).
- riffraff 7y agoIt does not help but doesn't hurt enough to grant a special syntax to avoid it. Yes, it limits your ability to rename a local variable, but that seems minor.
- Razengan 7y ago> That, incidentally, is why Swift added support for positional-only parameters (though it has no concept of keyword-or-positional). Swift's syntax is a lot more intuitive and consistent: function(parameterWithImplicitlyRequiredLabel: Int, differentArgumentLabel internalParameterName: Int, _ parameterWithoutLabel: Int, variadicParameterWithLabel: Int...) which you would call as function(parameterWithImplicitlyRequiredLabel: 1, differentArgumentLabel: 2, 3, variadicParameterWithLabel: 4, 5, 6, 7) [0] https://docs.swift.org/swift-book/LanguageGuide/Functions.html#ID166 https://docs.swift.org/swift-book/LanguageGuide/Functions.ht...