MOO-cows Mailing List Archive

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

Re: [SERVER] scattering assignment (was: wishlists)



On Sun, 28 Jul 1996, Gustavo Glusman wrote:
> Faraday wrote:
> >The new scattering arguement that pavel added to the 1.8 server,
> >I am finding that the next line below it is almost always (with me) a
> >typeof() check. It would be good to be able to have that done inside of
> >the scattering arguement too.
> ...
> >{o %(OBJ), desc %(STR, LIST)} = args;
>
> This is actually a great idea. If possible, I'd like the syntax to be
> something like:
> {OBJ: o, STR LIST: desc} = args;

I first suggested this back in January, for the same reasons, in
http://forney.scinc.com/~abakun/moomail/96.01/msg00363.html

I'm all for it, and I also favor something like Gustavo's suggested
syntax.  Two possible implementations come to mind:

(1) Do regular scattering first, stopping with any errors if necessary.
Then check types and return E_TYPE if any assignments that took place
don't match up (not counting optionals specified with ?)

(2) Take type information into account with scattering, and simply return
E_ARGS if the scattering can't happen.  A subset of this is already in
place by using @ to specify arbitrary-length lists.  We could extend this
concept to make empty assignments to any variable type ("" for STR, 0 for
int, etc.).

The first is probably easier to implement and use.
But does this server addition improve execution speed and efficiency, or
is it just a programmer's convenience?


michael




References:

Home | Subject Index | Thread Index