The Sparkling Programming Language(h2co3.github.io)
h2co3.github.io
The Sparkling Programming Language
http://h2co3.github.io/
6 comments
> Arrays are separate things than Hash-maps
I think this was a very elegant solution for Lua and ads to it's simplicity
I think this was a very elegant solution for Lua and ads to it's simplicity
So OS X can have window managers? Are there any already?
Kind of. You can do it with Apple's Accessibility APIs, but lately they're making that harder and harder. Apps that use those APIs can't be put on the app store, and there's no automated way to give an app permissions to use Accessibility: the user has to go deep into the System Preferences panel to enable it. And even then, the APIs, which aren't quite meant for window-managing, are very limited and sometimes don't work like you'd want them to. I forget how specifically, but I've written about a dozen of them so far and it's not a super pleasant experience. It's a little nicer in Swift, because you get to wrap the ugly C APIs in Swift using generics.
Also, iTunes tends to crash your program if you try moving/resizing it via Apple's Accessibility API if you're playing a video in it.
Technically you can run any of the window managers you use for Linux or BSD on top of X11, but you can only run *nix software, not Mac specific software, in those windows.
I threw together a quick, naive, FizzBuzz in it on their online demo, was surprised to find that it doesn't have a modulus operator. Can anyone come up with something simpler?
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.Hi, author here. Sparkling does have a modulo operator, it's spelled '%', just as in C (in fact, it maps directly to C's % operator).
Ideas looks like ACPUL. ACPUL is simple & easy algorithmic declarative language. It based on C-like languages syntax & sugar-free without noise, designed for minimalistic coding on mobiles.
Code sample: https://github.com/d08ble/acpul-demo/blob/master/atests/test...
Code sample: https://github.com/d08ble/acpul-demo/blob/master/atests/test...
This repo can haz README.md? :P
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
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
Please provide your iOS DeviceID to PM (encrypted, shure). I can make build for your personal demo. My native language is so bad, I'm autistic, pls understand me. Thanks.
Looks great and straight forward, just need a syntax.vim plugin and off to races with Sparkling for me.
Does it have GC? Or does it perhaps use reference counting? Can it detect cyclic references?
The readme seems to suggest it uses reference counting and doesn't do anything special about reference cycles:
> 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.
> 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.
Exactly, Sparkling uses reference counting, and one of the major TODOs is the introduction of weak references in order to address the issue of cycles.
Excellent! I was hoping that the answer would be that there is no GC.
Why are parentheses optional for functions? The big thing one can borrow from Python 3 is that there should be one way of doing something to save the community the endless unproductive fights of which one of the many ways of doing something is best!
I can remove that option at any time, if it turns out to be an important enough issue :)
I think having multiple options is always a bad idea for a language. It complicates the syntax and make people ask why not make parenthesis optional for loop statements as well? Then they perceive this as imperfect design - consciously or not. To me personally, this looks like a patch put in place just to entertain the Ruby crowd and is not along the lines of the solid unambiguous syntax that you're striving for!
- "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