Faraday is an experimental, strongly-typed language which compiles to Lua source.
- Type checking
any
andempty
(/#
) typesconst
(/incon
) variables- Variable assignment
- Variable reassignment
- Function arguments
- Function return value
- Invalid types
- Structs
- Type aliases
- Enums
impl
blocksstatic
methods (static fn ident(...) -> ... {...}
)- (optional)
assoc
methods (opposite of static, default;assoc fn ident(...) -> ... {...}
)
- Braces (instead of
do ... end
/then ... end
) - Async/await (coroutine wrappers)
- Async:
async fn ident(...) -> any {...}
- No need to change return type!
- Await:
#ident(...)
- (optional)
sync
methods (opposite of async, default;sync fn ident(...) -> any {...}
)
- Async:
else if
instead ofelseif
(big feature)use "..." as ...
instead ofrequire "..."
(with better module resolving)- Type visibility (
pub
/prv
)prv
is optional and is the default
- Automatic exports (anything set as
pub
is automatically)- This includes types, which the type checker will recognize!
- Syntax expressions (embedded functions while compiling)
- Expressions are imported using the
expr_use
function call in a macro expression:#[expr_use("./file_path")]
- The imported file should just contain a single function which has a name exactly matching the file name
- If the file name has a period in it (that isn't the extension), it can be represented using an underscore
- Expressions can be called using the
expr_call
function in a macro expression:#[expr_call(file_name, ...]
- The
file_name
should be an identifier which exactly matches the name of the file fromexpr_use
(just the file with no extension)
- The
- Expressions will be called and run using
luajit
. Their return value will automatically be printed to stdout, which will then be pushed to the compiler output instead of the expression incovation. - See the example here
- Expressions are imported using the
- Some sort of memory safety
- Variables must be referenced to be assigned as the value of another variable (
any var = &other
) - Variables are constant by default (can be made mutable by putting
mut
in the variable declaration)
- Variables must be referenced to be assigned as the value of another variable (
See the tests for some language examples!