Reserved words so far

The shorter this post is, the happier I’ll be. It’s meant to be more of a reference as I inevitably have to add new things. Assuming I remember to update it of course.

Words

fun
Function literal. Has special syntax for varargs and such. The last set of parens/braces is the body.
Argument to a function that is call-by-name, not call-by-value. That is, it’s only evaluated when the function body refers to it, and then it is evaluated each time.
lazy
Call-by-need function argument. Like the modifier form of fun, but with more caching. So it won’t work so well as a loop body, for instance.
Can modify a variable’s definition, as in x := lazy f(4), to defer the evaluation until it is needed, if it even is.
op
Used to create new (infix) operators, for example op+ := ..., like in Standard ML. Associativity and precedence declarations are still to come; they may just be infix{r,l,} statements like Haskell or something.
case
Pattern matching. The details aren’t really certain just yet, as proper matching is hilariously ill-suited to dynamic languages like this is. So maybe just a .matches method like Ruby’s ===.
var
Introduces a new variable. Indicates that you mean to shadow a variable in an enclosing scope (if there is one), rather than overwrite it.

Symbols

:=
Assignment. Local to the nearest enclosing (lexical) scope. Haven’t decided what to do about assigning to nonlocals yet. Also used in case, mostly just because it was already reserved.
.
Property lookup. Two in a row mean that the property itself starts with a dot (implying that it’s used for the machinery behind another function, like __python__ does.)

There are going to be a bunch more of these, most likely. I doubt I’m really going to keep := for case expressions, for instance.

Leave a Reply

You must be logged in to post a comment.