making an object:
{ expression | expression list sent to the new instance }
making a class:
my-class = class: { list of variable: expression list }
making an enum (* note #1):
my-enum = enum: { list of names }
array of things (last , is optional):
a, b, c,
empty array
()
making a union of classes:
first-class + second-class
making a composition of classes:
first-class * second-class
making a method:
[ signature | types | code block ]
method signatures:
foobar
foo: bar
foo: bar baz: biz
foo + bar
method types:
list of expressions that map to the parameters
list of expressions that map to the parameters → return expression
making a closure:
[ code block ]
[ types | code block ]
making a closure with variable capture:
[ variable captures | types | code block ]
[ variable captures | code block ]
getting a reference to a thing:
&thething
valid variable names:
foobar
foobar123
foobar?
-foo-bar-
_foo_bar_
strings:
"a string"
'a string'
`a string`
numbers:
123
-123
123.45
-123.45
booleans: (not a built in)
true
false
array access:
myarray[index]
myarray[index] = newvalue
array slicing:
myarray[start:stop]
myarray[:stop]
myarray[start:]
myarray[start::length]
myarray[::length]
binding a variable to a type:
myvar :: expression
compilation scopes:
public
package
private
using packages:
using: 'opengl'
ogl = using: 'opengl'
importing packages:
import: 'opengl'
early return from a code block:
^
^expression
typed arrays (* Note #2):
{ type | a, b, c, }
maps:
{ a: b, c: d, }
typed maps (* Note #3):
{ map-of: x to: y | a: b, c: d }
- Enums are using raw names that haven't been used yet and this might be a syntax error. Need to consider this more.
- Typed arrays don't really have a syntax yet
- Typed maps conflict with object creation; they look the same.
- Declaring a fixed-sized array on the stack. This might be done with a fixed-array class perhaps. Does it need special syntax?