> I am not the only one who feels that way.  Quoting Brent:
> 
> "But if you're going to call `init(integerLiteral:)` like it's `init(_:)`, I 
> don't think that's a good idea. Parameter labels are supposed to be 
> significant; we don't want to lose that.”
> 
> I agree with this.  That is the motivation for my suggestion.  I think it’s 
> at least worth discussing as an alternative to magically allowing an external 
> parameter label to be omitted.  Brent, what do you think of my suggestion?

I think it could be simpler:

        public struct Literal<LiteralType> {
                public let value: LiteralType
                internal init(_value value: LiteralType)
        }
        
        public protocol IntegerLiteralConvertible {
                associatedtype IntegerLiteralType
                init(_ literal: Literal<IntegerLiteralType>)
        }

Only the standard library can create a Literal, which it would do by 
constructing the IntegerLiteralType with its magic builtin literal stuff and 
wrapping it. You still have your magic parameter aspect, but without any actual 
magic, just access control. 

-- 
Brent Royal-Gordon
Architechies

_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to