Skip to content

release-0.5: Fix scoping for constants.

Compare
Choose a tag to compare
@skx skx released this 27 Aug 16:13
· 300 commits to master since this release

This release improves our language by adding several new features, the most obvious is that now "in-place" operators work for integers, allowing:

 let x = 1;
 x += 3;
 x *= 7;
 x -= 4;
 x /= 2;

 // x is now 12 

As a special case strings may be appended to via += too:

 let name = "Steve";
 name += " Kemp";

We've also updated function-definitions to allow default arguments, to allow code like this to work:

 function hello( name = "Steve" ) {  puts( "Hello, " + name + "\n" ); }
 hello();
 hello( "Bob" );

That code produces this output:

 Hello, Steve
 Hello, Bob

Finally we've added the ability to define "constant" variables, variables which cannot be modified:

 const PIE = 4;
 PIE = 43;         // This terminates the program.

The implementation of a few minor things has been cleaned up, and we've now implemented several of our core functions in 100% pure monkey - rather than in Golang. For example first(), rest() and last() are now 100% monkey, as are the definitions of the symbols PI and E.