bnmnetp/skulpt — pull request #103 by rixner (2013-08-01 19:42:12+00:00)
Title: Create None/True/False Python types

This wraps null, true, and false into Python objects. So, instead of using the raw javascript values (null/true/false) for None/True/False, you would now use:

Sk.builtin.none.none$
Sk.builtin.bool.true$
Sk.builtin.bool.false$

These are all singletons.

After numbers were encapsulated in Sk.builtin.nmber, these were the only raw javascript values left. So, this makes it so that all Python objects are now wrapped. I believe this helps clean up the code. For example, this eliminates the possibility of errors throughout Skulpt where null is dereferenced because the function did not expect "None" to be passed in as an argument (even though it is legal Python to do so). This also makes it possible to eliminate a lot of special case code where those three values needed to be treated differently than everything else (i.e., printing the name of the type in an error message, checking if an object is an instance of a type, etc.).

Ideally, I'd like to see all Python-facing functions only accept wrapped Python objects like this (not internal javascript representations) to make the code easier to maintain and add to. This is a step towards that.