News for hackers. Stuff that matters.
Re:The Sparkling Programming Language by sdegutis on Monday November 16, 2015 @11:21AM (#10575258)
The link compares it to Lua. Further reading reveals several improvements over Lua (IMO):

- "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

Re:The Sparkling Programming Language by CyberDildonics on Monday November 16, 2015 @07:59PM (#10578501)
> Arrays are separate things than Hash-maps

I think this was a very elegant solution for Lua and ads to it's simplicity

Re:The Sparkling Programming Language by listic on Monday November 16, 2015 @12:35PM (#10575742)
So OS X can have window managers? Are there any already?
Re:The Sparkling Programming Language by sdegutis on Monday November 16, 2015 @12:50PM (#10575827)
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.
Re:The Sparkling Programming Language by sdegutis on Monday November 16, 2015 @04:18PM (#10577233)
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.
Re:The Sparkling Programming Language by cmiller1 on Monday November 16, 2015 @01:24PM (#10576055)
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.
Re:The Sparkling Programming Language by cmiller1 on Monday November 16, 2015 @12:02PM (#10575534)
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.
Re:The Sparkling Programming Language by H2CO3 on Monday November 16, 2015 @12:17PM (#10575627)
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).
Re:The Sparkling Programming Language by cmiller1 on Monday November 16, 2015 @12:22PM (#10575662)
Oh! I didn't see it in the list of operators on the tutorial so I assumed it didn't.
Re:The Sparkling Programming Language by H2CO3 on Monday November 16, 2015 @12:30PM (#10575706)
No problem – documentation may still be somewhat incomplete at some places, sorry for that.
Re:The Sparkling Programming Language by d08ble on Monday November 16, 2015 @02:36PM (#10576586)
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...

Re:The Sparkling Programming Language by i336_ on Wednesday November 18, 2015 @12:08AM (#10586034)
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

Re:The Sparkling Programming Language by d08ble on Wednesday November 18, 2015 @08:33PM (#10592151)
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.
Re:The Sparkling Programming Language by joshbaptiste on Monday November 16, 2015 @05:48PM (#10577869)
Looks great and straight forward, just need a syntax.vim plugin and off to races with Sparkling for me.
Re:The Sparkling Programming Language by any1 on Monday November 16, 2015 @01:31PM (#10576105)
Does it have GC? Or does it perhaps use reference counting? Can it detect cyclic references?
Re:The Sparkling Programming Language by sdegutis on Monday November 16, 2015 @02:04PM (#10576347)
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.

Re:The Sparkling Programming Language by H2CO3 on Monday November 16, 2015 @02:40PM (#10576623)
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.
Re:The Sparkling Programming Language by sdegutis on Monday November 16, 2015 @03:57PM (#10577109)
Implementing weak references sounds like a feature that will make the language's source code much more complex than the simplicity emphasized in your goals.
Re:The Sparkling Programming Language by any1 on Monday November 16, 2015 @05:45PM (#10577846)
nim has some sort of automatic cycle detection. You might want to look into how they do it. It doesn't hurt to check it out.
Re:The Sparkling Programming Language by any1 on Monday November 16, 2015 @05:37PM (#10577798)
Excellent! I was hoping that the answer would be that there is no GC.
Re:The Sparkling Programming Language by wofo on Monday November 16, 2015 @02:37PM (#10576595)
How is reference counting deterministic in a multi-threaded environment?
Re:The Sparkling Programming Language by H2CO3 on Monday November 16, 2015 @03:19PM (#10576870)
in the sense that an object is deallocated as soon as all pointers to it cease to exist.
Re:The Sparkling Programming Language by nikolay on Monday November 16, 2015 @01:31PM (#10576106)
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!
Re:The Sparkling Programming Language by sdegutis on Monday November 16, 2015 @02:29PM (#10576542)
Meh. I'll take "too many syntax options" over "too few stdlib functions" any day. (I'm looking at you Lua!)
Re:The Sparkling Programming Language by johnmaguire2013 on Monday November 16, 2015 @03:54PM (#10577082)
False dichotomy?
Re:The Sparkling Programming Language by H2CO3 on Monday November 16, 2015 @02:42PM (#10576632)
I can remove that option at any time, if it turns out to be an important enough issue :)
Re:The Sparkling Programming Language by nikolay on Monday November 16, 2015 @10:56PM (#10579081)
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!
Re:The Sparkling Programming Language by johnmaguire2013 on Monday November 16, 2015 @03:54PM (#10577085)
And you'll break backwards compatibility with every app written prior.
Re:The Sparkling Programming Language by H2CO3 on Monday November 16, 2015 @05:22PM (#10577689)
Yes, exactly. So this should probably be decided early.