> 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
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to