Run Swift code at compile time


(Seán Labastille) #1

While I haven’t reviewed the videos in full I noticed a similar approach being taken in Rust where some more ambitious work is being done by the core team in libraries that use compiler plugins (https://doc.rust-lang.org/stable/book/compiler-plugins.html) such as regular expressions (https://doc.rust-lang.org/regex/regex/index.html). In the latter case even throwing compilation errors if the source file contains an invalid regular expression.

I suppose however that this is at best a Swift 3.1 feature to expose such interfaces once the dust from Swift 3 has settled. I may also be wrong that this is not a goal for Swift in the medium term at all.

Seán

···

On 22 Dec 2015, at 23:29, Matt Whiteside via swift-evolution <swift-evolution-request@swift.org <mailto:swift-evolution-request@swift.org>> wrote:

I don’t know if something like this has been done before, but I agree, the idea of the compile time version of the language being the same same as the runtime version, is very interesting. +1.

Matt