MOO-cows Mailing List Archive

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

Re: Operators



Michael Brundage drew these hieroglyphs:
> 
> 1) I like the idea of having ++/-- because I frequently write statements
> like count = count+1; and I'm lazy
> 
> 2) I don't really see the point in adding it to MOO, though.  If you're
> going to add something at this point, add something that can't already be
> done.  Of course, if you're creating a new system from scratch, then maybe
> this is something worth including.

I can.  Take this:

foo = {"tom", "dick", "harry"};
foo = {@foo, "jane"};

goes and creates a whole new list, splices foo into it, and tacks on
"jane".

With something like this:

foo @= "jane";
(the operator appearance is just a suggestion, blame Tef for that)

foo only appears once.  Just directly assign to foo.
Of course, it'll have to create a new list anyway, and destroy the old
copy of foo, right?  not necessarily.  one could grow lists longer
than necessary, and use that extra space at the end for tacking on
more elements.

or am i just way damn off?



References:

Home | Subject Index | Thread Index