News for hackers. Stuff that matters.
Re:Show HN: LiteScript by switz on Sunday March 09, 2014 @10:45AM (#7368555)
The only differences from literate coffeescript[0] I see from this demo are that the var keyword is back and print is a macro for console.log.

I applaud you for building something cool, but what are the "huge advantages" that you laud in the title?

[0] http://ashkenas.com/literate-coffeescript/

Re:Show HN: LiteScript by mistercow on Sunday March 09, 2014 @11:16AM (#7368633)
>The only differences from literate coffeescript[0] I see from this demo are that the var keyword is back and print is a macro for console.log.

It has more than that. Check the buttons down at the bottom. It has switch statements that look for a true expression, preprocessor macros, sugar for appending to classes (like Objective-C's categories), sugar for shimming, and "nice functions" for avoiding callback hell.

That's a lot more than you get with literate CoffeeScript.

Re:Show HN: LiteScript by bliker on Sunday March 09, 2014 @10:51AM (#7368568)
I did not know about Literate Coffescript. Thanks!

But I must say I found this link more informative http://coffeescript.org/#literate

Re:Show HN: LiteScript by lucio on Sunday March 09, 2014 @10:50AM (#7368565)
1. There's a compiler validation phase, it guess types from definitions and assignments, and will caught typos in object properties, saving hours of debugging subtle bugs. 2. No callback hell while keeping async programming ("yield until", node.js --harmony)
Re:Show HN: LiteScript by ulisesrmzroche on Sunday March 09, 2014 @01:14PM (#7369010)
Does this depend on using --harmony? Or are you faking the generators?
Re:Show HN: LiteScript by lucio on Sunday March 09, 2014 @02:34PM (#7369358)
today it depends on --harmony (only for "yield"), but it is trivial to add an option to use node-fibers instead (same functionality of ES6-generators for node>=v0.8).

See https://github.com/luciotato/waitfor ,node-fibers, and the same with generators: https://github.com/luciotato/waitfor-ES6

Re:Show HN: LiteScript by ulisesrmzroche on Friday March 14, 2014 @11:29AM (#7399430)
It's good that it's not faking generators though, stick with harmony. Fakes slow to a crawl after a while.
Re:Show HN: LiteScript by peq on Sunday March 09, 2014 @11:26AM (#7368652)
How does the type guessing and the type system in general work?
Re:Show HN: LiteScript by lucio on Sunday March 09, 2014 @11:32AM (#7368668)
1. Type guessing:

- if you have a "class Token" and later do "var token", the type is guessed by name affinity.

- if you do:

    token = .getToken()
    other = token
the type of "other" is guessed from assignment (:Token)

2. Type annotations: you directly state type

          var other:Token
          var read: Token array
The compiler does a "pseudo-execution" of the AST, guessing types and validating property access.
Re:Show HN: LiteScript by lucio on Sunday March 09, 2014 @10:52AM (#7368571)
The compiler is PEG-based, very easy to extend. Check the grammar: https://github.com/luciotato/LiteScript/blob/master/source/G...