Skip to content

20.09.0

Latest
Compare
Choose a tag to compare
@yaxollum yaxollum released this 17 Sep 17:05
cb37488

This major release brings a type system to Scrape. It solves the issue of inaccurate and inefficient floating point arithmetic.

Before, all Scratch variables were stored as C++ strings in Scrape. The problem with this representation is that whenever a mathematical operation needs to be done on two variables (e.g. division), the strings need to be converted into doubles, and then the result of the operation needs to be converted back into a string. These conversions are inefficient, and they also cause floating point arithmetic to be inaccurate.

Now, Scratch variables are represented using MultiType objects. A MultiType object can be either a string or a double. A MultiType object keeps track of its own type, and it can change its own type when requested by the Scrape interpreter. This ensures that type conversions are only performed when necessary.