A special, built-in value type: a 64-bit "fixnum"

Vitaly Davidovich vitalyd at gmail.com
Wed Apr 22 12:41:51 UTC 2015


Can you provide a somewhat concrete example where this would be useful?

sent from my phone
On Apr 22, 2015 7:12 AM, "Ron Pressler" <ron at paralleluniverse.co> wrote:

> Hi.
> I'd like to propose that the Valhalla project include a single special,
> built-in value type: a 64-bit "fixnum". The value has a single bit
> discriminating between a reference or a 63-bit long. It will, of course, be
> treated correctly by the GC.
>
> For completeness, a couple of static helper functions may be introduced.
> One that takes a long and, preserving the sign, truncates it to 63 bits,
> throwing an exception in the case of an overflow, and the other taking a
> double and truncating down to 63 bits, truncating precision by one bit (and
> another for the reverse 63-bit double -> double operation).
>
> I believe this will be immensely useful for some applications that
> currently require two separate arrays to store a value of either a
> primitive or a reference, yet would require minimal work for GC support. Of
> course, this proposal can be extended to directly support any 63-bit (or
> smaller) value type, but even in its minimal form it is extremely useful.
>
> Ron
>


More information about the valhalla-dev mailing list