writing-a-compiler-in-ruby icon indicating copy to clipboard operation
writing-a-compiler-in-ruby copied to clipboard

Handling Symbol and Fixnum (and true, false and nil)

Open vidarh opened this issue 15 years ago • 0 comments

MRI uses type tagging for those. Need to decide whether to do type tagging (more complex code) or do what Python does (memoize small integers) - the benefit of the latter is simpler code. Another alternative is to do method calls, but handle Fixnum "specially" for inline caching... This will cause crashes when we get the compiler to compile.

The simplest may be to implement Fixnum/Symbol as normal classes to start with.

True, false and nil are much simpler as they're single objects so avoiding type tagging is ok to start with, though not necessarily good in terms of performance.

vidarh avatar May 08 '09 13:05 vidarh