Re: Phix syntax
- Posted by irv Dec 18, 2020
- 995 views
I think that this would be well worthwhile to explore. Classes make the job of wrapping the huge GTK library fairly painless.
So far, even the complex widgets can be coded in less than 100 lines of code. And that code is clear and manageable.
This improved (more logical) syntax would help a lot in that regard.
Note: It appears that you may be able to have two (or more?) routines by the same name within a class without triggering an error. Run test below, it runs without warning or crashing.
class TestObj private integer handle; private string name; function TestObj() this.handle=rand(100000) return this end function procedure name(string s) this.name = s end procedure function name() return this.name end function end class TestObj y = new() ?y
So how does this work? Would it be possible to call the name() function when the syntax calls for a "read from" action, and call the name() procedure when the syntax indicates "write to"?
- ? y.handle or puts(1,y.handle) -- read from
- y.handle=n -- write to