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

Re: Is this the right behavior?



At 01:45 PM 12/26/99 -0500, you wrote:
>In Gwydion Dylan, the program:
>
>   define method foo() => ()
>     #"foo";
>   end method foo;
>
>   define method main(appname, #rest arguments)
>     let bar = foo();
>     format-out("%=\n", bar);
>   end method main;
>
>compiles without errors and when run prints "#f" to standard output.
>
>I was surprised because I had declared foo() to yield no values, and
>intuitively I'd expect this code to cause an error. When I checked the
>DRM, I couldn't figure out whether or not this was legal behavior.
>Can anyone help un-confuse me?

Yes this is the right behavior.  Page 43 of the DRM states:

   if there are more bindings than there are values,
   then the extra bindings are initialized to #f. ...

Jonathan Bachrach


References: