TROA Design Document Definitions: Expression: Assignments, operators, etc. Statements: def, if, for, etc. Closure: Block of expressions & statements surrounded by {}, first-class, may be anonymous. Tuple: Immutable ordered list, 0-indexed. Effectively a limited form of array. Enclosed by (). Class: Closure with special rules applied. - 'new' Prefix operator Array: Object: Type container, type building block, referenced by name. Operators: Arithmetic: + - * / % ^ Relational (Boolean): == ~=, ?=, != < > <= >= Ideas: Inheritance: Traditional object oriented languages implement inheritance in a manner that oftentimes can feel "backwards". Language should give the ability to dynamically control class scoping through some sort of mixin approach. Example 1: class Controller defines IController class CProcess implements IController class CThread implements IController x = Controller(CThread).new() Questions: - Scope resolution operator - Scope introspection? - Instantiation + mixing in by reference? Example 2: class XYZ defines a, b { a: method1 method2 b: method3 a,b: method4 } class 123 implements b { method3 method4 } - Consumer of class potentially binds to only one interface so class replacement can happen without the replacement class defining all of the original classes symbols, only those of the bound interface. Types: Integer(Object) - Implements a TypeNumeric Interface - Exposes "methods": +, -, *, /, %, ... Float(Object) Number(Object) - Mixes in Integer or Float Namespacing: namespace troa.foo {} troa/foo.troa import troa.foo import troa.foo.* import troa.foo as foobar Possible code samples: Number(1).iterTo(5) or 1.iterTo(5) for (i in 1.iterTo(5)) { print argv[0]; } for (x in Generator or Table) for (x, y in Table) while Expr { execute closure } while (Expr) {} - Single expression in Tuple while (Expr, Expr) {} - Multiple expressions in Tuple, all must evaluate True a = {} while Expr a ------ x = (a, b, c, d, e) |y, z..a| = x - y == a - z == b - a == e - or, z == (b, c, d) ? ----- Function x = (a, b, c) { (argv) ... } ... or ... x = (a, b, c) { } ... or ... def x(a, b, c) { } ??? - Argument vector initialized as an object with keys a, b, c