I recently dug up an old topic on Programmers SE — “Why do so many languages restrict string literals to a single source line?” and it provoked me to go through various programming languages. I liked Ceylon approach so much that I immediately implemented it as well. With a little twist — when the opening line is effectively empty it is removed and the base column is set to zero. Such code:
s String = " Hello World";
is equivalent to:
s String = " Hello\n World";
After reading Groovy in Action, 2ed. by Dierk König, Paul King, et al. I appreciated (again) the ability to drop parentheses on function call. Since I just removed /
operator for Int
I thought it was a great opportunity to implement it, which let mod
and div
methods to be called as operators:
x = a div b;
Nice, isn’t it? The moment I wrote the first piece of code using new syntax I realized it is a bug mine. Consider such code:
x = a div b + c; x = a mod b ^ c;
Do you know the precedence by heart? That is why this feature was short-lived. But the next one, also taken from Groovy is a must — power asserts. I planned to implement it a bit later, but since now I am writing bunch of real (i.e. executable) test cases for Skila and for the n-th time I hit old plain assert I decided — enough. I need this tool, and I need it for yesterday. Since I don’t have any keystroke to spare, please excuse me, I am heading back to Skila…