accessor inverse(void|float i)
^^^^^^^
Afterwards any access to 'myvariable' will call the function instead
^^^^^^^^^^ 'inverse' I hope?
It's excellent except that I would like syntactic sugar for get instead of counting arguments...
But that would/could coincide with something else, default values.
accessor inverse(float i=value) { ... }
where i gets the default value of value if not set. (I suggested this a long time ago.)
/ Mirar
Previous text:
2003-12-22 22:53: Subject: C#-like properties
Intiguing idea. Basically, you could just do it as a keyword:
float value;
accessor inverse(void|float i) { if(query_num_arg()) value=1/i; return 1/value; }
Afterwards any access to 'myvariable' will call the function instead of returning a function pointer, and any assignment will call the same function with a value.
/ Fredrik (Naranek) Hubinette (Real Build Master)