While discussing about an ExpressibleByTupleLiteral
protocol last year, it has been suggested to directly initialize with tuples instead of .init
in environments in which the compiler can correctly infer the right initializer:
_()
fits well from both an explicit and ergonomic standpoint in that regard, in my opinion.
Some off-topic considerations
It's true that Key
isn't needed before the structure name, but if you look in the Generics Manifesto section cited before, it has also been proposed an alternative and more compact syntax which involves the direct placement of the auxiliary parameter types, i.e. Key
, in the structure name:
If we allow parameterized extensions without a where
clause, we cannot annotate auxiliary parameter types there. They should be put after extension
and, generalizing, after struct
(and let
and var
for variables? Take a look at the Generic constants subsection).