Re: New keyword added: continue

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

Jason Gade wrote:
> 
> Matt Lewis wrote:
> > 
> > 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.
> > }}}
<eucode>
> > 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 ) )
> > </eucode>
{{{

> 
> Yeah, I had to recheck the docs after CChris mentioned it.
> 
> How does that affect non-method routines?
> 
> --
> A complex system that works is invariably found to have evolved from a simple
> system that works.
> --John Gall's 15th law of Systemantics.
> 
> "Premature optimization is the root of all evil in programming."
> --C.A.R. Hoare
> 
> j.

In self documentation, optimisation in returning vlues and again clearer code.
That's why it would be optional for non OO routines.

CChris

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

Search



Quick Links

User menu

Not signed in.

Misc Menu