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

David Sweeris davesweeris at mac.com
Fri Jul 1 08:26:14 CDT 2016


If we go with the “Compiler” alternative, it might make sense to put things like the language/toolchain version, host, target, etc there:
if Compiler.language.version >= 3 { celebrate() }
if Compiler.target.cpuCount * Compiler.target.coreCount > someValue {/* parallelize something differently than you would have otherwise */}

Or maybe someday we could use it for expanding the language’s syntax:
// Not sure if “Compiler.appendSyntax(...)” would be better
Syntax.append(/* something which makes sense goes here */)

There was something I was going to reply to yesterday which included a suggestion to add something to the Syntax namespace, but I can’t find it now, so I guess that draft got scrapped or something.

- Dave Sweeris

> On Jul 1, 2016, at 3:08 AM, Adrian Zubarev via swift-evolution <swift-evolution at swift.org> wrote:
> 
> We haven’t pass the dave test yet? :D 
> 
> Still curious what he’d say about Syntax.Literal.*Protocol
> 
> One more question:
> 
> What can the namespace Syntax could be used for except for literals, any idea? (I have no clue.)
> 
> 
> 
> -- 
> Adrian Zubarev
> Sent with Airmail
> 
> Am 30. Juni 2016 um 03:30:15, Matthew Johnson via swift-evolution (swift-evolution at swift.org <mailto:swift-evolution at swift.org>) schrieb:
> 
>> 
>> > On Jun 29, 2016, at 5:04 PM, Brent Royal-Gordon <brent at architechies.com> wrote:
>> > 
>> >> On Jun 29, 2016, at 7:41 AM, Matthew Johnson via swift-evolution <swift-evolution at swift.org> wrote:
>> >> 
>> >> `Syntax.IntegerLiteralType` is another that popped into my mind this morning. I don’t recall if that has been mentioned yet. The idea here is that an integer literal *can be typed as* a type that conforms to this protocol (the type suffix *is not* used in the sense that it used to be used in things like `SequenceType` which had the semantic that conforming types *are* sequences).  
>> > 
>> > Throwing my hat in:
>> > 
>> > IntegerLiteralCandidate (with or without a Syntax. prefix)
>> > 
>> > As in, when you see an integer literal and need to infer its actual type, this type is a candidate.
>> 
>> Thanks Brent.  
>> 
>> For everyone who is bike shedding here - feel free to continue informally. However, I don’t plan to incorporate every alternative from the bikeshed into the alternatives section unless folks feel it is critical to do so. I would prefer that everyone save their personal favorite(s) for the review period and continue the bike shedding at that time.  
>> 
>> The proposal already suggests the core team consider modifying the names based on bike shedding during review. I hope that will be sufficient.
>> 
>> > 
>> > -- 
>> > Brent Royal-Gordon
>> > Architechies
>> > 
>> 
>> _______________________________________________
>> 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/0c70e299/attachment.html>


More information about the swift-evolution mailing list