V0.3.8 RELEASE NOTES- Mar 12, 2017 | SHARE PAGE |
DOWNLOAD BETA v0.3.8
NOTABLE CHANGES
tl;dr:
More info on first class functions discussed in this post.
Used to assign passed parameter value to field in parent class with same name as parameter. Example:
class MyClass {
visible Int myField
public construct(this Int myField) {}
}
let myClass = MyClass(10)
Console.writeLine(myClass.myField) // outputs 10
This code is essentially the same as this:
class MyClass {
visible Int myField
public construct(Int myField) {
this.myField = myField
}
}
let myClass = MyClass(10)
Console.writeLine(myClass.myField) // outputs 10
But reduces code duplication.
The default state of variable declarations is now final. Final variables are good practice when writing software, and the easier it is to make final variables the better.
Previous
Int x = 10
x = 50 // valid
Current
Int x = 10
x = 50 // Compiler error, cannot modify final variable x
To declare a mutable variable you do this:
var Int x = 10
x = 50 // valid
Or, if you the type can be inferred from its assignment, you do not have to speficy the type:
var x = 10
x = 50 // valid
There will be a post on how to use Flat Test's unit testing framework here.
Fixed private function prototypes not being generated in C [Issue #372].