Releases: eobrain/funcgo
Double-space reguired around infix function calls
This release is mostly a change to the parser to handle whitespace in a uniform way.
The major change that is that the infix function-calling syntax requires two spaces around the function name. For example note the two spaces around str below:
greeting := "Hello "
name := "Eamonn"
greeting str name
=> "Hello Eamonn"which is equivalent to
greeting := "Hello "
name := "Eamonn"
str(greeting, name)
=> "Hello Eamonn"Operator Overloading and new Clojure Escape Syntax
You can now name your functions to be the same as the built-in operators like + and *, allowing a simple form of overloading.
This release also introduces a new syntax using pairs of \ characters to literally include Clojure code.
See the Operator Overloading section in the reference doc.
:= Specifies Constant
The major change in this release is that the := operator now defines a constant (which compiles to a let binding in Clojure).
In Version 0.2.7 and earlier:
- constants were specified with
const - vars were specified with either
varor:=
In Version 0.3.0 and later:
- constants are specified with
constor:= - vars are specified with
var
This may cause breaking changes to your code because:
- Any
:=that are not at the top of a block will now cause a syntax error. - The scope of the identifier is now only the block it is defined in. (Before it was either global or file-scope.)
The reason for this change is to encourage functional programming with immutable values as much as possible, by making the syntax for constants to be the less-verbose form. Also this syntax is more consistent with the other uses of := in for loops and if-else expressions.
For more details see the Const section of the language reference