Hacker News new | ask | show | jobs
by chrisbroadfoot 5419 days ago
It says it's for JavaScript, but I don't even know what language the code example is in. What is this?!

    # Create our application and namespace.
    class Alfred extends Batman.App
      @global yes
      @root 'todos#index'


    # Define the principle Todo model with `body` and `isDone` attributes, and tell it to persist itself using Local Storage.
    class Alfred.Todo extends Batman.Model
      @global yes # global exposes this class on the global object, so you can access `Todo` directly.

      @persist Batman.LocalStorage
      @encode 'body', 'isDone'

      body: ''
      isDone: false
1 comments

CoffeeScript
Right, I just read the comments below. There's no mention of CoffeeScript anywhere.

CoffeeScript is not JavaScript. If it's a JavaScript framework, please give code examples in JavaScript.

CoffeeScript compiles to Javascript. Batman.js can most certainly be a Javascript framework and give examples in CoffeeScript. Many people prefer CoffeeScript for a variety of reasons, including readability.

Also, you aren't entitled to dictate instructions to other people who are giving you the benefit of their hard work. It's rude and obnoxious.

Maybe the guy you're replying to edited his post, but "If it's a JavaScript framework, please give code examples in JavaScript"--to me--reads as a rather polite request, rather than a dictum as you suggested.
But there are other problems with the comment.

There's no mention of CoffeeScript anywhere

It's in the 2nd paragraph of the docs. Not prominent, but somewhere.

CoffeeScript is not JavaScript

Technically true, I suppose, but they are beyond related.

If it's a JavaScript framework

Maybe it's a CoffeeScript framework? My sense is that at the very least, the use of CoffeeScript is an important aspect of the project.

Your strawman argument that I'm dictating instructions is rude and obnoxious. Read my post again.
Mea culpa, and I'm truly sorry. I mistook your plea for a demand. Seppuku at dawn?
Except for at the top of the example you pasted, and at the top of the documentation page, under "Introduction" in big letters, whe it says "batman.js is a framework for building rich single-page browser applications. It is written in CoffeeScript and its API is developed with CoffeeScript in mind, but of course you can use plain old JavaScript too."

Where were you looking?

Shouldn't it be named batman.coffee?
Haha! Yes! Good call.

The first version of Batman was written in plain Javascript, but Shopify has really been falling in love with CoffeeScript, so we decided to rewrite it before it was released.

Batman.coffee is more correct but sure doesn’t have the same ring to it…

Same problem as Spine."js", playing hide the salami. Most JS devs still think JS means ECMAScript. Call it what it is. Python packages compile to C but they don't call themselves names like "Django.C", that would be disingenuous and obnoxious
In fact, Python packages do not compile to C, so calling Django Django.C would expose a complete lack of understanding of Python. In fact, batman.js is closer to a Jinja template being named with a .html extension.
Sorry, my bad, but you can replace Python with some Scheme implementation or anything else that compiles to anything. The point was "compiles to" != "is".