[swift-evolution] [Proposal] Add support for compile-time function execution

L. Mihalkovic laurent.mihalkovic at gmail.com
Thu Jun 9 00:48:24 CDT 2016


Chris has rules macros out-of-scope for 3.0. Who knows, maybe they'll be allowable in 4.0

> On Jun 9, 2016, at 1:41 AM, Alexander Momchilov via swift-evolution <swift-evolution at swift.org> wrote:
> 
> Preface: I know this is likely a large undertaking to implement, but I think it's worth it.
> 
> In addition to the typical compiler optimization of constant math expressions, some languages (such as D and C++) have support for running arbitrary functions at compile time (with some constraints).
> 
> I see many advantages of this:
> On iOS/OS X: it could precompute the UI and app initialization logic (wherever possible) to speed app load times
> It can significantly speed up the initialization of applications with large static properties. E.g. large constant Dictionaries could be precomputed.
> You could keep complex math expressions (including custom functions) in their unevaluated form, without the pressure to precompute them elsewhere and hardcode in the result.
> Dynamic programming: expensive look-up tables could be precomputed. These wouldn't necessarily be large in size, but if their elements are especially expensive to compute, there would be a huge advantage to precomputing them.
> 
> What do you guys think? Can you think of any other useful applications? Would it be worth the implementation effort?
> 
> - Regards,
>         Alexander Momchilov
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160609/b41e8a31/attachment.html>


More information about the swift-evolution mailing list