The Sparkling Programming Language
h2co3.github.io
h2co3.github.io
- "var", "let", and "extern" means no more accidental globals
- Arrays are separate things than Hash-maps
- Simple C API [1] that's not stack-based
- More built-in operators (even the conditional operator ?!)
- More "traditional" object/class concepts
- Strict typing!
- Fuller standard library
Neat!
My next project may very well be a Sparkling-scripted window manager for OS X.
[1]: https://github.com/H2CO3/Sparkling/blob/master/doc/capi.md
I think this was a very elegant solution for Lua and ads to it's simplicity
let divisible = fn (x, y){
return (x-(x/y*y))==0;
};
for let i=1;i<=30;i++ {
if divisible(i,15){
print("FizzBuzz");
}else if divisible(i,3){
print("Fizz");
}else if divisible(i,5){
print("Buzz");
}else{
print(i);
}
}
Edit: Correction, apparently it does have a modulo operator.Code sample: https://github.com/d08ble/acpul-demo/blob/master/atests/test...
Seriously, this looks really interesting, but "firehose of code!!1" is generally ideal for dispersion, not retention, and when combined with "ooo, I want to try this" results in a small sense of panic :P
> Another thing is garbage collection. It seems to be the silver bullet of automatic memory management when it comes to scripting languages, but it has some definitive, serious downsides. Non-deterministic behavior is one, speed is two, memory overhead is three, the difficulty of a decent implementation is four. Reference counting is a simpler approach that is more lightweight, easier to implement, completely deterministic and it has no memory allocation overhead (a program uses only as much memory as needed). Refcounting has its disadvantages too (e. g. memory leaks caused by cyclic references), but I believe that its good properties outweigh them.