[swift-evolution] Proposal: allow arbitrary compile-time code execution
Chris Lattner
clattner at apple.com
Mon Feb 8 15:39:38 CST 2016
> On Feb 8, 2016, at 12:54 PM, Steve Richey <srichey at gowithfloat.com> wrote:
>
> Based on the response, it seems like there's some interest, but the team wouldn't get to it until after Swift 3 at the earliest. Should I open a pull request to the swift-evolution repo to allow feedback and prevent duplicate proposals?
I don’t think that this makes sense. The proposals in the swift-evolution repo are required to have some informed discussion and debate in the community before a proposal can be accepted for further discussion. Until Swift 3 is out of the door, we can’t have that pre-discussion.
I’d suggest logging a ticket in bugs.swift.org to keep track of this, but it is also a well known area of exploration, so we probably don’t need to track it.
-Chris
>
> - Steve
>
> From: <clattner at apple.com <mailto:clattner at apple.com>> on behalf of Chris Lattner <clattner at apple.com <mailto:clattner at apple.com>>
> Date: Monday, February 8, 2016 at 1:13 PM
> To: Steve Richey <srichey at gowithfloat.com <mailto:srichey at gowithfloat.com>>
> Cc: "swift-evolution at swift.org <mailto:swift-evolution at swift.org>" <swift-evolution at swift.org <mailto:swift-evolution at swift.org>>
> Subject: Re: [swift-evolution] Proposal: allow arbitrary compile-time code execution
>
>
>> On Feb 7, 2016, at 8:29 PM, Steve Richey via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>>
>> It is not uncommon to want to run code at build time. Xcode solves this need by allowing "Build Phases", which are often shell scripts which handle compile-time tasks.
>>
>> It may be beneficial to Swift developers, especially those who are not programming on platforms supported by Xcode, to handle compile-time tasks in a powerful and expressive language with which they are already familiar: Swift!
>>
>> In short, I propose the addition of a `#run` expression that allows the execution of code at compile time. This syntax and concept are borrowed from the programming language Jai (https://sites.google.com/site/jailanguageprimer/#TOC-Arbitrary-Compile-Time-Code-Execution <https://sites.google.com/site/jailanguageprimer/#TOC-Arbitrary-Compile-Time-Code-Execution>) but the syntax fits nicely with other special expression syntax in Swift such as `#available`, `#selector`, `#file`, and so on.
>
> Something like this would definitely be interesting to build out. We should investigate it post-Swift 3 in the context of a hygienic macro system.
>
> -Chris
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160208/8c40da41/attachment.html>
More information about the swift-evolution
mailing list