we are about to introduce some very exciting new functionality:
* function calls - calling functions from within the bandicoot
* modules - keeping things encapsulated
* attribute sets - making type composition easier
obviously these new features impact the bandicoot language one way or another. in order to keep the syntax consistent with the new features it was necessary to perform some syntax adjustments. i've implemented these adjustments on top of the current functionality in the origin/syntax branch at bandilab.org.
if you want to see how your programs will look like with the proposed changes, you can use the program converter (bin/convert). while working with the branch keep in mind that all the tests and data is checked in using the v4 notations and prior to using the branch you need to run 'ctl convert' (only once).
here is a brief summary of changes:
1) operators and function calls are prefix, e.g. "opname (arg1) (arg2) .. (argN)" where braces required only for compound statements. here are some examples:
---
join books authors
union books newBooksminus books topAuthors
summary minPrice = (min price 0.0) books
summary maxPrice = (min price 0.0) books titles
project firstName, lastName users
rename id = login users
extend newPrice = price * 1.10 books
select price < 10.0 books
myFunc books "penguin"
---
infix versions of the union, minus, and join operators are also available along with the corresponding assignment shortcuts (+, -, *, +=, -=, *= accordingly), but program converter will replace everything with the prefix statements.
2) new keyword "type" and the simplified syntax for relational type declarations
---
type Books {title string, pages int, price real}
---
essentially the relational type is enclosed within the curly braces and there are no more colons and "rel" keyword. this change prepares for the attribute sets and makes declarations less heavy.
3) new keyword "var"
---
var shelf Books;
var myBooks = select author == "me" books;
---
all variables declarations should start with "var".
4) new keyword "void"
--
fn Append(b Books) void {...}
---
if a function does not return anything it should specify "void".
your feedback and review comments are welcome!
- ostap