Zahir
Zahir is an attempt to join the convenient syntax of Matlab with the structure, performance, and compile-time safety of a statically typed programming language. To learn a little more about the language you can check out a blog post I wrote (mostly about the type system). There's also an older version which doesn't do an awful lot. Until I have more time, this page will probably serve mostly as a place to clarify thoughts and keep myself vaguely motivated.
Unfinished Business
- Implement constructors with arguments (currently 'type' keyword produces only enums)
- Implement constraint propagating type inference for inferring the appropriate classes associated with types
- Implement polyvariadic functions using the Zip Calculus
- Write a Sequence constructor class for polyvariadic map function
- Reimplement matrix to derive from Seq, giving automatic elementwise operations for all functions defined on scalars
- Rewrite typechecking of function calls to
attempt usual unification between args type and expected type
failing that, check if all sequences in args are same container
repeat type checking with contained types and return sequence of function result
transform syntax tree at scalar expanded calls to use polyvariadic map
Scrap special cases for unary & binary operators, parse their usage as function calls
Make all typenames capitalized, lowercase type identifiers should be automatic typevars
Add a kind system
Add constructor and type classes to the lexer and parser
Drop row, col datatypes. Shape analysis of matrices should be a static step distinct from type checking.
Background Reading
- A modern eye on ML type inference by Francois Pottier
- Good overview of basic Hindley-Milner type inference (as well as extensions for recursive algebraic datatypes)
- A system of constructor classes: overloading and implicit higher-order polymorphism by Mark P. Jones
- Extension to type class overloading adding support for higher-kinded types (such as trees, arrays, option types, etc..).
- Type inference and implicit scaling by Satish Thatte
- Promote scalars to array or list datatype by using map operator. Well, there's a ton more here, but that's the briefest summary.
- Normalize, transpose, and distribute: An automatic approach for handling nonscalars by Daniel Cooke, et al.
- A dynamic semantics for scalar expansion/implicit scaling. Lots of potential (underutilized?) with Thatte's work above.
- The Zip Calculus by Mark Tullsen
- Genericity over tuple length (ie, write zipWith2, zipWith3, and friends as just one function)
- General Homomorphic Overloading by Alex Shafarenko and Sven-Bodo Scholz
- Every overloaded operator is associated with a linear ordering over the valid types of its arguments. This, unfortunately, doesn't work for function arguments: the presented type system doesn't support higher order functions.