[swift-evolution] Proposal: label-only constructors
ilya
ilya.nikokoshev at gmail.com
Sun Dec 13 07:13:40 CST 2015
> There is no "parameter" to pass here; in particular the user should not
be expected to know off the top of their head what the key size for
Curve25519 is.
You can easily call a private parametrized init from a class function
though.
> The trailing colon gives me some anxiety; I feel like it wants something
to follow it.
Sure, it's not the most beautiful construct, but it unambiguously
identifies the preceding token as a label name.
On Sun, Dec 13, 2015 at 16:09 Drew Crawford <drew at sealedabstract.com> wrote:
>
> On Dec 13, 2015, at 7:03 AM, ilya <ilya.nikokoshev at gmail.com> wrote:
>
> (1) Isn't using a class function just one more symbol?
>
>
> No, a class/static function is not the same as an initializer. e.g., a
> class function cannot assign to a let ivar.
>
> (2) Wouldn't this syntax be more logical:
> Key {
> init(forRSA: Void) { /* */ }
> }
>
> Key(forRSA:)
>
>
> Maybe. The trailing colon gives me some anxiety; I feel like it wants
> something to follow it.
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151213/2837af6f/attachment.html>
More information about the swift-evolution
mailing list