[swift-evolution] [Proposal Draft] Literal Syntax Protocols

David Sweeris davesweeris at mac.com
Fri Jul 1 16:58:42 CDT 2016


Yeah, I’ve been wondering if there’d ever be a way to convert something into a *Literal… I can’t think of why, other than as a way to cast between types which are both “ExpressibleAs*Literal", but then the protocol would have to be strengthened to indicate that the conversion had to be lossless.

- Dave Sweeris

> On Jul 1, 2016, at 4:39 PM, Adrian Zubarev via swift-evolution <swift-evolution at swift.org> wrote:
> 
> The only problem I can see with ExpressibleAs is that it also reads if I could potentially do something like this type <-> literal, but the direction type -> literal is impossible.
> 
> 
> 
> 
> -- 
> Adrian Zubarev
> Sent with Airmail
> 
> Am 1. Juli 2016 um 23:33:19, Matthew Johnson via swift-evolution (swift-evolution at swift.org <mailto:swift-evolution at swift.org>) schrieb:
> 
>> 
>> > On Jul 1, 2016, at 3:59 PM, Dmitri Gribenko via swift-evolution <swift-evolution at swift.org> wrote:
>> > 
>> > On Fri, Jul 1, 2016 at 1:35 PM, Dave Abrahams via swift-evolution
>> > <swift-evolution at swift.org> wrote:
>> >> I think if `Syntax.IntegerLiteral` is actually unclear then the best
>> >> cure is `ExpressibleAsIntegerLiteral` (no namespace needed). None of
>> >> the other suggestions I've seen describe what the protocol means as well
>> >> as that. I've asked Matthew to update the proposal accordingly.
>> > 
>> > I also like `ExpressibleAsIntegerLiteral`. It uses the ~ible/~able
>> > convention which suggests a capability, and when the name is worded
>> > like this, it is definitely describing a capability of the type.
>> 
>> I like it quite a bit as well. It’s the best name anyone has suggested.  
>> 
>> I have updated the proposal to reflect this decision. Any further comments should be in the context of this new draft.
>> 
>> > 
>> > Dmitri
>> > 
>> > -- 
>> > main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
>> > (j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/
>> > _______________________________________________
>> > swift-evolution mailing list
>> > swift-evolution at swift.org
>> > https://lists.swift.org/mailman/listinfo/swift-evolution
>> 
>> _______________________________________________
>> swift-evolution mailing list
>> swift-evolution at swift.org
>> https://lists.swift.org/mailman/listinfo/swift-evolution
> 
> 
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org <mailto:swift-evolution at swift.org>
> https://lists.swift.org/mailman/listinfo/swift-evolution <https://lists.swift.org/mailman/listinfo/swift-evolution>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160701/6cb3160a/attachment.html>


More information about the swift-evolution mailing list