Clone wiki

scopes / Scopes Release 0.9

Scopes Release 0.9

What's New?

  • A SPIR-V backend that allows to compile functions to SPIR-V as well as GLSL on the fly.
  • A new syntax for named let, addition of for ... in and while forms, and a new as operator that permits chaining casts.
  • Support for immutable pointers which permit the compiler to fold load instructions during partial evaluation.
  • Support for SIMD vector types, making generation of SPIR-V and SSE/AVX instructions possible.
  • Functions which perform runtime work can now backpropagate constants to callers, which opens new avenues of metaprogramming. Mixing constant and variable return values is now illegal though.
  • Compilation speed has been moderately, quality of generated output massively improved.



Documentation is available online.


  • constants are now always propagated to return continuations via constant-carrying return type [f1ff20b0c075]
  • function types of compiled labels return a ReturnLabel type by default to preserve returned constants [f1ff20b0c075]
  • fixed a bug where closures in syntax-extend sections would not be eliminated [f1ff20b0c075]
  • renamed unknown type to Unknown [f1ff20b0c075]
  • cache LLVM types over all invocations [f1ff20b0c075]
  • require also searches for folders with the module name that contain an file [f1ff20b0c075]
  • pointers are immutable by default [dd1149e75f03]
  • mutable pointers can be constructed with mutable-pointer-type or pointer T 'mutable [dd1149e75f03]
  • performing load on immutable pointers can be resolved at compile time [dd1149e75f03]
  • attempting to perform a store or free instruction on immutable pointers will fail [dd1149e75f03]
  • mutability of a pointer type can be queried with mutable? [dd1149e75f03]
  • alloca and malloc return mutable pointers [dd1149e75f03]
  • the reference type uses a mutable storage pointer [dd1149e75f03]
  • if the input pointer to getelementptr is mutable, the returned pointer will also be mutable [dd1149e75f03]
  • C pointers with/without const-qualifiers are translated to immutable/mutable pointers respectively [dd1149e75f03]
  • C pointers to functions and vectors are always tagged as immutable [dd1149e75f03]
  • nullof always returns a constant [726d28ab0c15]
  • allocaof constructs a constant pointer for constant values and a regular alloca for non-constant ones [726d28ab0c15]
  • fixed broken insertvalue [726d28ab0c15]
  • fixed array support for IR generator [726d28ab0c15]
  • typify returns constant result when invoked with constant parameters [044fdfa44adf]
  • IR: added basic support for unions [bfb42ee83fe7]
  • basic vector support: vector-type and constructor overload for vector supertype [2fc47ed0f526]
  • added insertelement and extractelement instructions to build and deconstruct vectors [2fc47ed0f526]
  • added shufflevector instruction [2fc47ed0f526] [e22811ec9315]
  • all arithmetic and comparison instructions also support vectors [2fc47ed0f526]
  • added arithmetic sugar for float vectors [e22811ec9315]
  • added vectorof factory function [e22811ec9315]
  • added join operator for vectors [aa57e4552b0c]
  • arithmetic and comparison operators for integer and real vectors [0a2b73400f0c]
  • any? and all? reduce a vector of booleans [0a2b73400f0c] [c9504fd544ad]
  • load can be performed on extern values [0a2b73400f0c]
  • added dispatch function unpack for types of constant length whose members can be unpacked [5618c7b5ea4c]
  • vectors support unpacking [5618c7b5ea4c]
  • fixed locals to resolve all parameters returned in the scope [20348009493f] [11c9e86ff68f]
  • the local scope within functions does no longer contain special symbols like recur and return [20348009493f]
  • error! does not print errorneous location information anymore [20348009493f]
  • declaring let without assignment rebinds names in local scope [c1a746d7a1d3]
  • declaring named let without any names and assignment can be used to set up infinite loops [c1a746d7a1d3]
  • renamed cast to as and softcast to imply, and changed order of parameters [b38156f060bd]
  • as and imply can be used to vaguely cast to supertypes [d6918e44d236]
  • changed named let syntax to look closer to function declarations and get rid of the square brackets [c0418316e5c7]
  • as can be used as infix operator and chained to perform casts in succession [b38156f060bd]
  • values of type Syntax can also be converted to Any to extract datum [bad52925eb1b]
  • match also accepts quote and or in patterns [bad52925eb1b]
  • added do-in which is a do that leaks its scope; useful for exposing temporary values in an if-block or during argument passing [bad52925eb1b]
  • added for ... in ... foreach generator [6d0143defc25]
  • added zip, range generators [6d0143defc25]
  • added while statement [c0271eb3cde4]
  • added arrayof constructor function [354cfb86b6bc]
  • fixed crash when constructing composites of strings [dbe232090689]
  • using imports static symbols immediately where possible and only generates code for runtime symbols [11c9e86ff68f]
  • using also imports all symbols from parent scopes [11c9e86ff68f]
  • Scope-parent enables to get the parent of a scope [11c9e86ff68f]
  • using import imports a module directly into the local namespace [c4c5ab602ab8]
  • traceback prints all participating functions [85d4a1da1591]
  • support for compiling scopes functions to SPIR-V and GLSL using compile-spirv and compile-glsl [b9684242b8e0] [50661b8df605] [86e2cb732891] [aa0fdf525e41] [6731e8f1dad6] [cf698a2df775] [1190b5c56b4f] [144e5034c269]
  • forward calls to labels are being eliminated if the target label is not recursive [9523d91832e3] [3f8fcd95cf07]
  • continuation calls to labels are being eliminated if the target label just forwards the received parameters [9523d91832e3]
  • functions that only perform a single instruction or return immediately are inlined [11c11d0a13ea]
  • fixed most cases of accidental branch duplication [5222ad7283df]
  • mangle an already evaluated function if it doesn't return any closures [4a3046e8fa6c]
  • disabled a test that fails on win32 for now [707492ce6d4c]