TeamShadow / shadow

Reference compiler for the Shadow programming language.
http://shadow-language.org/
Apache License 2.0
12 stars 8 forks source link

Turned arrays into objects and removed dynamic class loading #66

Closed bwittman closed 7 years ago

bwittman commented 7 years ago

First, arrays are now objects. Although this makes arrays a little heavier weight, it means that they can be used in any situation an Object can be, without any transformations. Arrays and nullable arrays are different types although their memory layout is the same. This change improves memory management since there is no concern about creating and freeing wrapper classes for arrays.

Second, all Class objects, including those for generic classes, are constructed at compile time. Although the design is somewhat different, this change actually reverts back to the style of class construction from a couple of years ago. Classes that contain partial parameterization (such as a CanIterate<T> inside of a LinkedList<T>) are recorded in the .meta file so that they can be reconstructed without needing the full source code.

The disadvantage of constructing all Class objects is that executable size will be larger since a lot of class data needs to be stored.

The advantages are many: