Hacker News new | ask | show | jobs
by btipling 4875 days ago
Why not call it hexagonal.coffee? Why do CoffeeScript libraries get a .js extension? Yes I realize it works for JavaScript too, but it's weird to go see a library with *.js in the name and then to find only CoffeeScript in the documentation.
3 comments

You read my mind, and I couldn't agree more; might as well call it hexagonal.cpp because hey, eventually it'll get run as C++.
We'll try to deliver new examples in pure JS.
That was an honest question more than a complaint. Why do CoffeeScript libraries not use the coffee extension? For broader appeal? Even if you had JavaScript documentation, I would see the source was written in CoffeeScript and realize I can't easily evaluate the quality of the source. Choosing CoffeeScript must mean you prefer it over JavaScript, so why use the extension of a language you do not prefer over one you do?
Ok, now I see what you meant. So basically we don't want to limit audience of that idea to just CoffeeScripters. Also: maybe we'll switch to JS some day - if community show the need.
You can look at the source just like any other js project. It might not look totally clean as a hand-written project, but there are absolutely worse things than looking at compiled coffeescript (cough lodash https://github.com/bestiejs/lodash/blob/master/lodash.js#L38...)
To be fair, that's a template you linked...

Also, why go out-of-your-way to bash another project? Why didn't you link the hexagonal source you mentioned, which would have been productive, instead of lodash?

That template is source code for a function, it becomes the body of many lodash methods using eval. It's not out of my way, it sits right on top of my personal "ugly code" list; couldn't think of a better (worse?) example.

As I understand it there is no hexagonal source, it's just an architecture.

Because it is javascript, to be used by javascript projects. Not having JS examples is just a problem in the docs, not the library.
No, it's not JS.

    > class UseCase
    SyntaxError: Unexpected reserved word
Of course the point is it's not clear what it means to "be JS". Is it more important for the name to express what syntax the source code is in or what platform the code can run on? I think for your average developer who just wants to consume a library, they care more that it is a javascript-based library that they can use.
Of course CoffeeScript code won't run as javascript, it's not a superset. But it operates on the same global scope, the same object model, with similar semantics, so it "is" javascript, unlike other compile-to-js languages.

After reading more about it, I agree that it shouldn't have .js in it's name, or any other language extension, since it's not a framework/library. The fact that the examples are written in CoffeeScript is incidental.