rubinius/rubinius — pull request #1694 by ryoqun (2012-05-02 02:50:07+00:00)
Title: Support weakly-referencing to all kinds of objects

Current WeakRef implementation doesn't support to reference to nil and false.

The reason for nil is that it can't know whether referenced object is nil or it
is garbage-collected and set to nil. The reason for false is that there is an
incorrect assumption that referenced objects can't be evaluated to false.

By adding a new field to C++ WeakRef class to record whether referenced object
is immediate or reference, WeakRef truly supports all kinds of objects.

Personally, I think the increase of WeakRef's size is well justified by the realized consistency in this case.

FYI, MRI's WeakRef doesn't support to referencing to immediates at all. So, as an alternative design decision, we can follow it.