[swift-evolution] Proposal: 'T(literal)' should construct T using the appropriate literal protocol if possible
Brent Royal-Gordon
brent at architechies.com
Fri Jun 3 17:25:53 CDT 2016
> I think our decision should be based upon which syntactic construct feels least inconsistent with other similar syntactic constructs and therefore feels the least arbitrary. Restricting the usage of a generic `Literal` type to literal convertible initializers feels a little bit less arbitrary than allowing the call site to omit a label, but it feels a little bit more arbitrary than introducing an attribute that has a very specialized context of applicability.
Honestly, I think `@literal` is only "consistent" with the rest of the language in that @s are used to mark compiler magic. `Literal<>` is attempting to *not* be much more magical than, say, `StringInterpolationConvertible`, where a particular syntax generates a certain pattern of calls.
--
Brent Royal-Gordon
Architechies
More information about the swift-evolution
mailing list