[Prev][Next][Index][Thread]

Re: multiple values in a return from function



"John Whittaker" <johncwhi@earthlink.net> writes:

> define method compute-solar-position( epoch-day :: <integer> ) =>
>   ( results :: false-or( <astro-position>))
   [...snip...]
> 
>    values( right-ascension, declination );
> end method;

It's possibly because you are declaring the return result as being a
single value (of type false or instance of class <astro-position>),
whereas you are actually returning two values. The compiler will be
ignoring the second value.

Try it with just (ie. no return value declared):

> define method compute-solar-position( epoch-day :: <integer> )
   [...snip...] 
>    values( right-ascension, declination );
> end method;

Chris.
-- 
http://www.double.co.nz/dylan



References: