Re: Phix syntax

new topic     » goto parent     » topic index » view thread      » older message » newer message

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
new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu