Exit Full View

Feather2 / documentation / Keywords.md

Keywords

Here are a list of Feather's keywords :

abstract, apply, as, break, catch, class, constructor, continue, do, else, enum, finally, for, fun, if, in, is, import, include, interface, init, library, meth, null, open, override, package, return, static, super, this, throw, try, val, var, while, with.

You cannot use them as identifiers (i.e. as variable/field or function names).

The following type names can also be considered keywords (but they aren't implemented as such) :

void, bool, byte, char, short, int, long, float, double.

Note, functions are assumed to be void if no return type is specified. So void is never seen in feather scripts.

apply, with

There are two odd keywords : apply and with. They correspond to Kotlin's apply() and with() functions, which take a lambda as their last parameter. I really like using apply and wtih, but lambdas aren't supported yet. So instead, I've hard-coded these functions into the language itself (and therefore apply and with are keywords).

At some point, I hope to remove them as keywords, and replace them with an extension function in the feather runtime (similar to Kotlin).

Back to Contents