Live data from Hacker News

Riot – A React-like, 2.5K user interface library

muut.com

191–200 of 222 posts

Re: Riot – A React-like, 2.5K user interface library

#191

Looks nice. +1 for enclosing JS in a script tag. Vuejs has a nice component compiler: https://github.com/vuejs/vue-component-compiler It puts JS inside of a script tag, which would fix some of the parsing issues, and also fix syntax highlighting. It also provides hooks for pre-processors. Have you considered this approach?

Need to consider the script tag.

Re: Riot – A React-like, 2.5K user interface library

#192

Earlier quoted context omitted.

muut.com uses Riot for authentication, signups and for forum settings which is a fairly large application. The site is fairly popular. Of course React is much more tested and probably more solid at this point and Riot 2.0 is just released. But one major benefit for Riot is that there is indeed 24x less code to maintain and so much less weak spots to take care of.

Do you think that the 24x less code is because of its exceptional design? Or is it missing some features?

The design is vastly different. DOM update logic is more straightforward. We realized that heavy diffing is not needed.

Re: Riot – A React-like, 2.5K user interface library

#193

Earlier quoted context omitted.

Currently styling is outside Riot's responsibility. Shadow elements are not supported enough on browsers and require too much polyfilling. Also not sure about component- based styling in general. I think that CSS should be controlled separately <-- highly personal opinnion.

Your whole point about polyfilling really avoids the issue that web components/Polymer is trying to address. Of course polyfilling is needed now for that, but until we have it, we won't have truly reusable web components, and claiming Riot can substitute Polymer is therefore a pretty big bait and switch, cool though Riot.js may be.

I would say that Riot does very much what Polymer is trying to address - which is custom tags.

The implementation and syntax is different so it's not a drop- in replacement, but both have similar goals.

Re: Riot – A React-like, 2.5K user interface library

#194

It would be cool to summarize the kind of stuff you can or can't do with Riot vs React. I still don't get how state works, whether state changes propagate down the components as prop changes like in React, etc.

Each component maintains it's own state. Think them as functions with isolated scope. The tags accept arguments via HTML attributes and each tag has a reference to it's parent.

Instance variables and method are assigned to the scope and you have direct access to them on the HTML expressions. Once the scope changes and tag's `update()` method is called the expressions are calculated and DOM nodes are updated. Nested children are also updated.

You can update all tags at the same time with a global `riot.update()` method.

Hope this helps.

Re: Riot – A React-like, 2.5K user interface library

#195

Earlier quoted context omitted.

Not sure but this might indeed fail. Can you place an issue to github? Thanks! Maybe it's good to split HTML and JS with the last HTML tag.

The compiler also fails if a multi-line comment doesn't end at the end of a line. and more text It outputs an empty compiled file. My honest opinion is that you should consider rewriting the compiler in a classic tokenize-parse-compile style. Several projects (like mustache.js) have had to go through this evolution. Your current solution -- line-by-line with regexes and state flags -- will only get hairier and hairie…

Well, maybe a line-by-line solution is good enough, I mean, it would only target a subset but the code will be readable. I still think though that any compiler which is intended for real apps should do the classic tokenize-parse-compile steps.

Re: Riot – A React-like, 2.5K user interface library

#196

Earlier quoted context omitted.

The compiler also fails if a multi-line comment doesn't end at the end of a line. and more text It outputs an empty compiled file. My honest opinion is that you should consider rewriting the compiler in a classic tokenize-parse-compile style. Several projects (like mustache.js) have had to go through this evolution. Your current solution -- line-by-line with regexes and state flags -- will only get hairier and hairie…

Well, maybe a line-by-line solution is good enough, I mean, it would only target a subset but the code will be readable. I still think though that any compiler which is intended for real apps should do the classic tokenize-parse-compile steps.

I'll start by improving the current implementation and see how far I can go with it without making it crazy.

I'll start tokenizing after a concrete use case.

Definitely keep this in mind. Thanks!

Re: Riot – A React-like, 2.5K user interface library

#197
post #147

I just wish there was a way to fast forward 2 years into a 10k LOC project to find out what new problems this creates. After running after the new hotness in technology for the last 5 years, I've realised it's never about the problems it solves today. It's the shit that you have to maintain a couple of years down the line. (Not saying that this is bad -- just a random rant)

FWIW, the framework I wrote (Mithril) is a direct product of working on a multiple-man-year Angular codebase and the pains that arise from such a beast. I wrote about that here ( http://lhorie.github.io/mithril-blog/lessons-learned-from-an... ) On a related topic, I talk about complexity walls (the idea of code that outgrows a framework's zone of comfort) here ( http://lhorie.github.io/mithril-blog/decreasing-cogniti…

Mithril is a tremendous little framework, and Leo has done an exemplary job of writing it, documenting it and blogging about usage patterns and tricks. While declining frequent requests that he cram more functionality into its core, he takes the time to explain the trade-offs, showing a deep understanding of the problem space which gives me confidence to build upon his work. So thanks Leo!

Hopefully, in time, more people will realise the "zen" of mithril's minimal approach. In the meantime, interested readers can check out lichess.org, which recently rewrote its impressive UI using mithril.

Re: Riot – A React-like, 2.5K user interface library

#198
post #142

I just wish there was a way to fast forward 2 years into a 10k LOC project to find out what new problems this creates. After running after the new hotness in technology for the last 5 years, I've realised it's never about the problems it solves today. It's the shit that you have to maintain a couple of years down the line. (Not saying that this is bad -- just a random rant)

I tried GWT years ago. It worked amazingly well, and let me write web apps in a real language. But it was significantly slower to develop a new site in GWT vs. plain vanilla HTML + CSS + JavaScript, and the speed to get up and running eventually seduced me away. Now I'm considering going back and giving it another try. It takes more time to get up and running with GWT, sure, but the stuff you do write with it is writ…

The other advantage with GWT I see is.. as the target changes, your app doesn't have to, only the transpiler.

GWT can output to ExtJS, to , to . And barring minor changes, your code stays the same.

Now that is worth the investment.

Re: Riot – A React-like, 2.5K user interface library

#199
post #147

I just wish there was a way to fast forward 2 years into a 10k LOC project to find out what new problems this creates. After running after the new hotness in technology for the last 5 years, I've realised it's never about the problems it solves today. It's the shit that you have to maintain a couple of years down the line. (Not saying that this is bad -- just a random rant)

FWIW, the framework I wrote (Mithril) is a direct product of working on a multiple-man-year Angular codebase and the pains that arise from such a beast. I wrote about that here ( http://lhorie.github.io/mithril-blog/lessons-learned-from-an... ) On a related topic, I talk about complexity walls (the idea of code that outgrows a framework's zone of comfort) here ( http://lhorie.github.io/mithril-blog/decreasing-cogniti…

Mithril "HTML" syntax is not for my taste:

return m("html", [

    m("body", [

        m("input"),

        m("button", "Add"),

        m("table", [

            m("tr", [

                m("td", [

                    m("input[type=checkbox]")

                ]),

                m("td", "task description"),

            ])

        ])

    ])
]);
Post reply on HN