Daniel Keep, el 27 de julio a las 02:29 me escribiste: > > Syntax don't have to be changed, unless templates are not allowed > > (syntactically) in interfaces (I'm too lazy to check right now :). > > > > And template syntax don't have to change either. This is already valid > > AFAIK syntax AFAIK. What it has to be changed, is the semantics, because > > int opGet(foo)(); should be interpreted as a read property instead of > > a templated function. > > Ok, I should have said "semantics" instead of syntax. > > The thing is you're proposing that template syntax doesn't *actually* > mean a template if the identifier is "opGet". opGet effectively becomes > a keyword; so you may as well just bite the bullet and add "property" as > a keyword.
Why it is a keyword? I know is a little controversial to change the meaning of template syntax based on the function name (and I think that's a good point for dismissing my proposal) but I really don't get why do you think that it's like adding a keyword. You don't have to make opGet a reserved word, you could use a variable named opGet if you want, the same you can use opCall or the other "magical" method names. I'm not really sure what is worse from a philosophical POV, if changing the template syntax meaning for opGet (opGet(prop)) or extract semantic information from a method name (opGet_prop). I think that the former looks a little cleaner at least =) > >>> I used an example without trivial properties because... well, you just use > >>> member variables for that. That's why I don't see real value in adding > >>> default properties getter/setters. > >> interface I > >> { > >> int opGet_value(); > >> } > >> > >> You cannot use fields in an interface. > > > > Yes, and...? > > You have an interface. One of the things it needs to do is provide > access to a field. You can't just declare a field; you have to have an > accessor. In most situations, the implementation will simply want to > expose some internal field. So, you think there should be an easy way to define default getter/setters? If that's what you're saying, I didn't saw how that is handled in your proposal, I'm sorry, I'll take a look again. -- Leandro Lucarella (luca) | Blog colectivo: http://www.mazziblog.com.ar/blog/ ---------------------------------------------------------------------------- GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145 104C 949E BFB6 5F5A 8D05) ---------------------------------------------------------------------------- Un camión lleno de amigos, míos. Cada uno dando vueltas, en su cabeza. Mientras yo, sufro la picadura de mi propia abeja.