Tino Heth: If you read my reply to Daniel Vollmer, you’ll find that we’re thinking about the exact same thing. Your code snippers show my vision of compiletime beautifully 🙂. Now what I really want at this point is to here the opinions of the core team on this topic.
Swift Core Team: Have you guys thought of this? Do you think this is a good idea to put on the table or do you have different plans? > On Jul 30, 2017, at 7:56 PM, Tino Heth <[email protected]> wrote: > > >> more elaborate compile-time facilities, which would also provide extremely >> powerful meta programming features > That's an interesting twist — but whenever you put a "meta" somewhere, things > tend to get complicated, and people end up with different associations to the > topic… ;-) > I took a brief look at the C++ document, but it seemed still to much > macro-like to me. > > My take on the topic would be he ability to express common programming tasks > (declaring a class, overriding a method…) in the language itself. > Imagine > public class ProxyViewController: UIView {} > Could be written as > let subclass = createClass(classname: "ProxyViewController", superclass: > UIViewController, accessLevel: .public) > > Quite stupid at first sight, and basically the exact opposite of syntactic > sugar ("syntactic salt" already has a meaning… so I'd call it "syntactic > pepper" ;-). > But now imagine that: > > for (method, implementation) in UIViewController.methods where > method.accessLevel == .open { > subclass.methods[method] = { parameters in > print("Subclass method \(method) called with \(parameters)") > return implementation(parameters) > } > } > > > Not that stupid anymore, isn't it? > I think this would be way cooler than poking around with variants of search & > replace… > > - Tino > > (to get syntax colouring, I wrote ~30 lines of Swift that turn the straw man > example into valid code… it's fun, maybe I play with it a little bit more ;-)
_______________________________________________ swift-evolution mailing list [email protected] https://lists.swift.org/mailman/listinfo/swift-evolution
