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


> Under what circumstances should a language implementor *not* use
> copy-on-mutate?  Where's the cost?

Any lazy evaluation has a wierd impact on performance... the net
performance is always as good or better than eager evaluation but it
happens at different times.  This makes profiling a mess and can be
tricky for real-time applications.  Most scripting people don't care
about either.

Some lazy schemes have issues with side effects (especially errors and
exceptions!) happening at unpredictable times, but with copying you're
safe... no side effects should occur (unless you have copy
constructors, but that's a whole other mess).

The only other argument against copy-on-mutate I can think of is that
it makes the language implementation slightly more complicated.  

I think it is a good fit for scripting languages and would like to see
it in more of them.  It saves you GC time and heap space as well as
execution time and isn't that hard to implement.  


Do You Yahoo!?
Check out Yahoo! Shopping and Yahoo! Auctions for all of
your unique holiday gifts! Buy at http://shopping.yahoo.com
or bid at http://auctions.yahoo.com