IDE 1.6.6 and above have it enabled by default.
Good to know, thanks.
And yes, I would like to add ranged loops, I have also been thinking about having a 'for .. in ..' syntax to express them.
Its nice that C11 supports them out of the box, but it probably makes sense to generate C++98 as you said.
In terms of writing the grammar - there is really not much difference between having a 'for' or 'foreach' to indicate a ranged loop, but I would really like to get away with just using 'for' (it currently also replaces 'do' and 'while' loops)
PS I'd be interested to see your example as well if you don't mind?
Although I do not think it is a good idea having the brackets optional, and the curly brackets mandatory. Just enforce both.
To be honest, after a couple weeks of constantly testing the language - I just got really used to omitting the brackets. But you are not the first one to mention this, so I will probably change this in the nearest version.
[ A quick Update ]
I spent some more time on function evaluation. There are still a couple things to tweak, but overall I am quite happy with it.
I also added default function argument values. It uses a well-established syntax (e.g. like Python)
int multiply (int a, int b = 2) {
return a * b
}Now if you call:
multiply(7) - with just one parameter,
the compiler will automatically add the default one:
multiply( 7, 2 )Right now the default values can only be literals (strings, numbers, etc.) but I am planning to allow using
constss as well.
All default params - must be declared last, so you can't have this:
int multiply(int a=1, int b) {} // (compiler will throw an error)What I really like about this feature is that all the default parameters are resolved during compilation, so there is no overhead for using them. It is of course mostly just a developer convenience.
You can check the latest versio
n here http://webcloudtools.com/sprk/lang-test/#functions(I updated the functions example)
Next step is gonna be adding arrays and working on string concatenation.