News for hackers. Stuff that matters.
Re:Elm for the Front End by munro on Thursday July 09, 2015 @05:25PM (#9860787)
Yea... In theory it would be nice to have any DSL style created in the language, but in practice it seems easier to specifically build HTML-like syntax into the core language (like JSX). Or build a separate language like Haskell's Hamlet [1], or Python's Jinja [2].

[1] http://www.yesodweb.com/book/shakespearean-templates [2] http://jinja.pocoo.org/

Re:Elm for the Front End by grey-area on Thursday July 09, 2015 @05:42PM (#9860900)
Another approach is to invert the problem and use html web components - so declare new objects in html and separate the logic. That feels far more natural to me than an almost html (react) or some sort of dsl which shadows html mixing up logic, data and presentation - html is the one part of the web stack which is pretty much fit for purpose, why try to replace it?

See Polymer for an example of using this in current browsers:

https://www.polymer-project.org

The markup is just custom html elements separate from the behaviour (in js). e.g. a dialog:

https://elements.polymer-project.org/elements/paper-dialog?v...

    <paper-dialog>
      <h2>Header</h2>
      <paper-dialog-scrollable>
        Lorem ipsum...
      </paper-dialog-scrollable>
      <div class="buttons">
        <paper-button dialog-dismiss>Cancel</paper-button>
        <paper-button dialog-confirm>Accept</paper-button>
      </div>
    </paper-dialog>
Re:Elm for the Front End by munro on Thursday July 09, 2015 @05:53PM (#9860963)
Good point! I do really enjoy writing Angular templates. Embed the language in HTML, instead of the other way around. :D

As an aside, PyCharm is a great editor, it can understand Angular, HTML, CSS, and Jinja all in the same file, and does lots of helpful introspection for me. For example, I can command click any property to jump to it's definition, as well as syntax highlighting for all these languages.

Re:Elm for the Front End by zem on Thursday July 09, 2015 @06:26PM (#9861108)
clojurescript has lovely html syntax; it's probably my favourite to write. i generally prefer mlish to lispish syntax, but s-expressions fit the problem of representing a tree structure perfectly.