-
Notifications
You must be signed in to change notification settings - Fork 8
TL2 Features
Meir Cohen edited this page Mar 14, 2018
·
1 revision
First compiler with state
- Blocks now not need to end in blank line
- Expressions can have multiple function calls
- Classes can now have methods, declared by
func instinside the class,selfcan be used inside - All system functions changed to methods
- Correct handling of return values,
outis removed - Array indexing works anywhere with
[index],[] <type>is removed - String indexing
str[index] - Array and String slicing anywhere
- Expression initialization
- Complex else-if expressions
- Error traceback now prints MR file information
- Inheritance: class3es can inherit from one base class
- Basic polymorphism: class can define
func dynamicmethods that will be overridden by inherited classes. But:- a class without dynamic methods should be declared using
staticinstead ofclass - All
func dynamicmethods should have an implementation - All inheriting classes must implement all dynamic methods of it's bases - and in the same order
- New dynamic methods must be added after the base class dynamic methods
- a class without dynamic methods should be declared using
- References are automatically up-caste in simple assignment and function arguments
- Methods can be called directly by
[class-name].[meth-name]([self], ...) -
returnis added to functions end automatically - no need to add it manually - Basic multiple file support: allow splitting of one file to multiple files - MR2 compiler can receive multiple files and treat them as one file in the given order. Generates C file for each file where the last one includes all others.
- Support empty references, set with
_and test with? [reference]
Suggestions, comments and questions are welcome!
