diff options
-rw-r--r-- | chickadee/graphics/seagull.scm | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/chickadee/graphics/seagull.scm b/chickadee/graphics/seagull.scm index 9f5aaeb..278ca63 100644 --- a/chickadee/graphics/seagull.scm +++ b/chickadee/graphics/seagull.scm @@ -681,13 +681,11 @@ ;;; Typed expressions ;;; -;; Transform all program expressions into typed expressions by -;; applying a variant of the Hindley-Milner type inference algorithm. -;; GLSL is a statically typed language, but thanks to type inference -;; Seagull code doesn't need type annotations. -;; -;; This section includes all the kinds of types an expression may have -;; and various transformation procedures to manipulate them. +;; Typed expressions combine a Seagull expression with the data types +;; that expression returns. This section includes all the kinds of +;; types an expression may have and various transformation procedures +;; to manipulate them. This will be used below to convert the mostly +;; untyped Seagull program into a fully typed one. ;; Primitive types: (define (primitive-type name) @@ -1051,7 +1049,9 @@ ;;; ;; Convert untyped Seagull expressions into typed expressions with -;; variable components that need to be solved for. +;; type variables representing all unknown types. This annotated +;; version of a Seagull program can then be passed to the type +;; inference algorithm to solve for all of the variables. (define (lookup-type name env) (let ((type (lookup name env))) @@ -1230,7 +1230,10 @@ ;;; ;; Walk the expression tree of a type annotated program and solve for -;; the type variables present. +;; all of the type variables using a variant of the Hindley-Milner +;; type inference algorithm. GLSL is a statically typed language, but +;; thanks to type inference the user doesn't have to specify any types +;; expect for shader inputs, outputs, and uniforms. (define (compose-substitutions a b) (define b* @@ -1523,7 +1526,7 @@ ;;; GLSL emission ;;; -;; Transform typed expressions into a string of GLSL code. +;; Transform a fully typed Seagull program into a string of GLSL code. (define (type-name type) (primitive-type-name type)) |