From fa2618f6508f910615bf7755451673e10a24d568 Mon Sep 17 00:00:00 2001 From: Justin Ethier Date: Fri, 31 Jul 2015 22:54:53 -0400 Subject: [PATCH] Added data type section --- docs/History.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/docs/History.md b/docs/History.md index fa54df8e..cc92711d 100644 --- a/docs/History.md +++ b/docs/History.md @@ -93,7 +93,15 @@ Here is a snippet demonstrating how C functions may be written using Baker's app ## Data Types -also mention object types and value types from lisp in small pieces +Most Scheme data types are represented as allocated "objects" that contain a tag to identify the object type. For example: + + typedef struct {tag_type tag; double value;} double_type; + +On the other hand, some data types can be represented using 30 bits. These types can be stored as value types using a technique from Lisp in Small Pieces. + +Depending on the underlying architecture, compiler, etc these types have extra least significant bits that can be used to mark them as values instead of objects. On many machines, addresses are multiples of four, leaving the two least significant bits free. + +Cyclone uses this technique to store characters. The nice thing about value types is they do not have to be garbage collected because no extra data is allocated for them. ## Interpreter