3 ms·
I see the benefits of Opal, but can anyone enumerate the downsides? I imagine it generates quite a bit of cruft as CoffeeScript does (of course, one argues that
by Dirlewanger 11y ago
I see the benefits of Opal, but can anyone enumerate the downsides? I imagine it generates quite a bit of cruft as CoffeeScript does (of course, one argues that developer satisfaction in using said language outweighs the extra lines added to JS files).
- lucisferre 11y agoI have not used it, but I would guess interop with existing JS libraries is awkward. The cognitive overhead of working in such a different syntax from the underlying libraries. I'm guessing these are quite a bit higher than say Coffeescript (which I have quite a big of experience with).
- pheroden 11y agoIt's been a while since I tinkered with it, but the size of the library was the biggest turn off. It's currently at 259k for the min version. That's a lot to add, especially if you're targeting mobile.
- segphault 11y agoCoffeeScript is largely just a shorthand built on existing JavaScript idioms, so the output is more or less 1:1. In order to provide some of the capabilities and behaviors that you would expect to find in a real Ruby environment, Opal has to use a fair amount of runtime code. As a result, the tracebacks and error messages that you get from Opal are often very unhelpful. I also found that quite a few of the libraries in the Opal ecosystem (like the opal-browser library that wraps a bunch of important native web features) are fragile and under-documented. That said, Opal worked far better than I actually expected. I built a simple demo with it a few months ago and was pleasantly surprised by many aspects of the experience. There's a third-party React wrapper called React.rb that is quite impressive. I wrote about my Opal demo app here: https://www.rethinkdb.com/blog/ruby-opal/ https://www.rethinkdb.com/blog/ruby-opal/ And here are the slides from a talk I gave about full-stack Ruby development: https://speakerdeck.com/segphault/realtime-web-apps-with-rethinkdb-and-full-stack-ruby https://speakerdeck.com/segphault/realtime-web-apps-with-ret...