Re: [Vala] Extension Methods



Hi,

Frederik wrote:
These 'categories' are even named, so you can group these additional
methods thematically. If Vala considers such a feature I would propose
the following syntax:

 public class string category SpellChecking {
     // ...
 }

 public class Gtk.Widget category GLFunctionality {
     public bool set_gl_capability (...) {
         // do stuff.
     }
     // ...
 }

These category names would get lost in C code, but they could be nice
additional information in a Vala object browser.

But then why not using an aspect-orientated notation ?

In aspect-oriented language, inner-type declarations are defined in an aspect. An aspect, thus, defines correlated functionnality that spans multiple classes.

public aspect GLFunctionality {
        public bool Gtk.Widget.set_gl_capability(...) {
                // do stuff...
        }
        
        // Some other inner-type declaration
        // ...
}

I think that adding syntax to the language should be very carrefully thought. IHMO, I think that we should stick for now to adding annotations that would modify the compiler/generator's behavior.

Best regards, Didier.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]