Tomasz Zielonka:
...
there are other reasons to box values besides implementing laziness,
like for simplifying the memory model (which can simplify GC
implementation), allowing to intermix values of different types
(different kinds of polymorphism) or allow variable sized values (think
strings, arrays and arbitrary size integers).

Some concrete examples: Arrays in many scripting languages, like Python,
are often boxed. There are some languages, like R, where there are many
types of unboxed arrays, for efficiency reasons.

There are nice unboxed arrays in Clean as well. The gain of efficiency is
enormous. ==
Hmmm.... I thought that arrays in Python have no reason to be boxed. Lists,
yes, since they are untyped, so they are arrays of pointers, but arrays are
homogeneous. I don't know why boxing may simplify the *memory model*.
The most dramatic effect of implicit boxing is the possibility -
available in Smalltalk - to change the *identity* of an object. You
write (x become y), and all references to the object assigned to x, point
now to something completely different. A terrible weapon. Jerzy Karczmarczuk
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to