Re: New keyword added: continue

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

Jason Gade wrote:
> 
> CChris wrote:
> > 
> > - supportfor optional : return_type in funvtion headers
> 
> What is "optional : return_type in function headers"? That sounds like a move
> away from genericity to me.

You could overload class methods as long as they had different signatures.  
ooeu mangled names similar to C++.  So you could have two different methods
with the same name and same number of parameters.  The return type helped
the parser figure out which method to use based upon the return parameters
from functions.  It wasn't enforced in ooeu.
euclass complex( sequence c )
    atom real, imaginary
    
    function add( atom a ) : complex
        ...
    end function

    function add( complex c )
        ... 
    end function

    function complex( atom r ) : complex
        return {r, 0}
    end function

    function complex( atom r, atom i ) : complex
        return {r, i}
    end function

    function complex( complex c ) : complex
        return c
    end function
end euclass

complex x, y
x = complex( 0 )
y = complex( 5, 2 )

x = x.add( 3 )
x = x.add( y )
x = x.add( y.add( 2 ) )


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

Search



Quick Links

User menu

Not signed in.

Misc Menu