-
Notifications
You must be signed in to change notification settings - Fork 8
TL4 Features
Meir Cohen edited this page Apr 30, 2018
·
3 revisions
First "full" and "safe" compiler - all features to easily write a module, (almost) no crashes
- Function outputs with
->instead of: - Ignore empty lines
- Any depth of sub-typing
- Every reference is treated as optional
- Specific output file
- Generate C89 standard code
- Enforce
varandcopyin primitives - Support
structandclasstypes only - Dynamic pointer in reference
- Function objects
- Dynamic allocation in expression:
Type{parameters}(...) - Constructors:
new(...) - Managed and weak reference support
- Use
isandis-notto compare references - Read from stdin using
sys.getcharandsys.getline - Add file objects
stdout,stdin,stderr - Removing
EOF, char getters now also return whether EOF reached - Re-support
nativeto run external C code - Can extend generic types
- Basic error handling
try # an error here will jump to the end of the block (and will be ignored) catch # if an error happens this block will run - For-each loop:
for [value] in [iterator], an iterator is a number, string, array, or any type with functionshas()->(Bool),get()->([type])andnext(), [value] should be a variable of type [type] - Complex members
- Change documentation to start and end with
~~~, comment line symbol to be;and comment block to start with[;and end with;] - Verbose run-time errors, can raise with message:
raise [string expression] - Multi-line strings:
str := "multi line string" ; is like str := "multi\nline\nstring" ; and str := "split\ line" ; is like str := "splitline" - Code coverage:
mr4-compiler -t [tested-module] ... - Better mocking:
- can mock builtin functions
mock Sys.println(user String s) ... - can call mocked function
func.mocked(...) - can deactivate and activate mocks
func.active := false
- can mock builtin functions
- Int constants:
const Int NAME [value] - Basic Enums:
; decleration enum Name VALUE ANOTHER-VALUE ; usage Name.VALUE Name.length - Basic module system: each file should start with
module [module-name]
Suggestions, comments and questions are welcome!
