rubyopalrb

What are the limitations of Opal?


I'm very keen to try Opal in a new Rails project, but the risk of course is that I won't discover what it can't do until I've spent hundreds of hours doing everything else, and run into a brick wall that I can't possibly get through.

What are its limitations?

For example (and of course answers should not be limited to these topics if there are other limitations worth mentioning) I would assume that you can't just use any old Ruby library in your Opal code (but I'd love to find out that I'm wrong about that!).

I would also guess there might be difficulties in using any arbitrary JavaScript library, or that there are cases where you need to write JavaScript to interface with those.

And of course there could be all sorts of issues that I haven't even begun to imagine. It looks like an amazing project, but I want to know what gotchas I might encounter unexpectedly if I were to just dive in head-first.


Solution

  • From a Ruby standpoint:

    From a JS standpoint:

    That said you usually can get a lot of stuff done with just using Native or opal-jquery. I personally have found myself moving classes from the backend to the frontend more than once. Testability and code readability surely improves (as long as you write good Ruby) and you can reuse your OOD skills.

    I surely may be missing something, anyone is welcomed to chime in. And it will eventually turn into a blog post on http://opalrb.com/blog.

    tl;dr

    Don't forget you are in a browser. Don't underestimate the power of Ruby.