Previous system linked the variable name with the saved value, meaning the variable could not be renamed or moved outside the global scope.
Instead we propose to store all persistent values in a global table, identifying each by a key. To still allow nice manipulation with identifiers, the alias syntax replace the persistent syntax for symbols - an aliases symbol will act as if a function call was used in place of the identifier when it appear.
The previous system needed to store of the scope and full AST to build a Resumable object, which means that if persisted, updating the resumable script will have no effect.
The new system instead uses an anchor token and does not require any information besides the anchor name.
Woke up and felt like changing a couple things. It's actually been worked on for a while, little at a time...
The goal was to make the language and implementation much simpler. Well I don't know if it really ended up being simpler but it sure is more robust.
Main changes:
* proper first class functions and closures supports! proper scoping rules! no more namespace shenanigans!
* everything is an expression, no more statements! make the implementation both simpler and more complex, but it's much more consistent now! the syntax has massively changed as a result though.
* much more organized and easy to modify codebase: one file for each AST node, no more random fields or behavior set by some random node exceptionally, everything should now follow the same API defined in ast.abstract.Node
Every foundational feature should be implemented right now. The vast majority of things that were possible in v2 are possible now; some things aren't, but that's usually because v2 is a bit more sane.
The main missing things before a proper release are tests and documentation. There's a few other things that might be implemented later, see the ideas.md file.
* add suffix unary operators
* add _! operator
* _._ and _&_ operator overloading
* allow calling function references with _! and access variables with _._
* rename . method operator to !
* various cleaning & improvements
Documentation will follow at some point.
- Bumped to 0.15.0
- Add boot script
- Change variable definition syntax, using a = to distinguish more cleary between identifier and value
- Variables initial values are evaluated on first use instead of at parsing time
- Error on variable redefinition. Means you should make sure to load saves after your scripts.
- Improve string parsing, support for escape codes
- Remove support for number literals with empty decimal part (42. for 42.0) as there's no distinction in Anselme and it conflicts with .function call suffix
- Changed priority of : pair operator
- Add type type, and type annotations to variables and function parameters
- Change Lua function system to use regular Anselme functions
- Defining a function from Lua is now way simpler and require providing a full Anselme function signature
- Change Anselme function system
- Dynamic dispatch, based on arity, type annotation and parameter names. Will select the most specific function at runtime.
- Define way to overload most operators
- Allow custom type to text formatters
- Allow assignment to custom functions
- Index operator ( renamed to ()
- Functions with parameters each have their own private namespace (scoping ersatz)
- Internal: "custom"-mode operators now have their own expression AST type instead of cluttering the function system
- Remove static type checker as it is barely useful with new function system. May or may not rewrite one in the future.
- Improve error messages here and there
- Internal: cleaning