Phix syntax
- Posted by irv Dec 18, 2020
- 1264 views
Here's something to think about:
When using classes, the syntax seems backward. For example:
Window w = new() w.set_name("Main") -- calls procedure gtk_widget_set_name() ? w.get_name() -- calls function gtk_widget_get_name() - displays "Main"
It would seem to me less awkward if it looked more like:
Window w = new() w.name="Main" -- sets the name, like x=3 would set the value of x ? w.name -- displays "Main" same as ?x would display 3
IOW, class properties would work like normal variables. Is there any possibility that there's a way to do this?
We can already get partway there by declaring public fields:
export class Window extends Widget public string name;
- ? w.name works if you have previously included a line to set the public field as a part of procedure gtk_widget_set_name()
- the assignment: w.name="Foo" doesn't have a way to call function gtk_widget_set_name(), AFAIK.