SE-0415: Function Body Macros

This will be a great addition - quick question;

Could computed variables be declared via the "no-body" syntax functions can be declared with?

For example:

extension MyType {
    @Foo var name: String

    // expands to
    var name: String {
        "Foo"
    } 
}

(note this is in an extension so a stored property wouldn't be allowed here but leaving out the curly braces after the definition is more readable than not)

1 Like