7 ms·
Rails bindings for Opal
- jgrowl 11y agoHow easy is it to call native javascript libraries with opal? Having to write wrapping code stinks.
- icebraining 11y agoSeems pretty easy: $window = Native(`window`) puts $window[:location][:href] # => http://localhost/ puts $window.document.querySelector('title').innerText # => "Test page" http://dev.mikamai.com/post/65322179075/opal-give-it-a-try http://dev.mikamai.com/post/65322179075/opal-give-it-a-try
- sdegutis 11y agoThe people behind Opal are really awesome. I've spoken to them a few times about this project and they really do know their stuff. Opal looks very promising to anyone who's still using Ruby.
- amazing_jose 11y ago«...who's still using Ruby.», is the last part of your comment implying that they are an endangered species?
- guide42 11y agoYes
- sdegutis 11y agoI no longer use Ruby, we've moved to Clojure full-stack. But I still like to look at Opal from time to time.
- lectrick 11y agoI'll just leave my tweeted photo from ElixirConf right here. https://twitter.com/pmarreck/status/650430959951593472 https://twitter.com/pmarreck/status/650430959951593472 That was a live survey done during the session. The long yellow bar, in case it's hard to read, represented Ruby. It's not that hard to see why: https://speakerdeck.com/mosic/elixir-at-evercam?slide=6 https://speakerdeck.com/mosic/elixir-at-evercam?slide=6
- sdegutis 11y ago> It's not that hard to see why: https://speakerdeck.com/mosic/elixir-at-evercam?slide=6 https://speakerdeck.com/mosic/elixir-at-evercam?slide=6 I'm not sure that's a fair explanation. You can do any of these things in the implementation language of a web app. But splitting them out into external applications has other advantages.
- lectrick 11y ago> But splitting them out into external applications has other advantages. Such as?
- aquilaFiera 11y agoSeem like a lovely bunch of nice and inviting people. https://github.com/opal/opal/issues/941 https://github.com/opal/opal/issues/941
- sdegutis 11y agoLook, it's the guy's own personal twitter account. He can say what he wants. And he's put his own work into an open source project, voluntarily. Despite what many seem to think, there is no "universally agreed" morals and views. So if you want to oust people you disagree with, don't be surprised when others oust you. Or better yet, we'd all be better off if we all just learn to work peaceably with people we disagree with.
- spoiler 11y ago> Look, it's the guy's own personal twitter account. He can say what he wants. And he's put his own work into an open source project, voluntarily. He's promoting Opal on that same Twitter account, though. A parallel: It's like saying he can bully someone outside of class, and that as long as he sits nice and quiet in class, the school shouldn't do anything about it. Quite frankly, I think the Internet got to his head. > Despite what many seem to think, there is no "universally agreed" morals and views. So if you want to oust people you disagree with, don't be surprised when others oust you. True, but his statement was a soft-core version of hate speech. > Or better yet, we'd all be better off if we all just learn to work peaceably with people we disagree with. He didn't simply disagree, though. He's being outright offensive about it: "not accepting reality is the problem here," and "anyway it's months that in Italy school after school sneaks genderism lessons in without parents consent. Not cool," yes okay, let's not educate people, because that's well cool, innit blad.
- sdegutis 11y ago> He's promoting Opal on that same Twitter account, though. So? It's his personal twitter account. He can do what he wants with it. He can say the Surface Book is great, or Opal is great, or Opal sucks. That doesn't make anything he says there into an official endorsement or opinion of the Opal project. > A parallel: It's like saying he can bully someone outside of class, and that as long as he sits nice and quiet in class, the school shouldn't do anything about it. The difference is that bullying is actually against rules. Expressing your views on something controversial like this is perfectly allowed due to freedom of speech. > True, but his statement was a soft-core version of hate speech. For one specific definition of hate-speech, sure. But not one that's universally agreed upon. In other words, that's like, your opinion, man.
- eggie5 11y agoThis is what coffee script should have been!
- DamnYuppie 11y agoI found CoffeeScript clunky. I like how Opal has the js files in the same place as the views, much cleaner imho. This honestly maybe possible with the current sprockets but I have never found out how.
- aikah 11y agohmm no. Coffee script can use any external js library without the need of complicated "bindings". Coffee script is mostly Javascript with a different syntax. Opal has totally different semantics.
- deleted 11y ago[deleted]
- Dirlewanger 11y agoI 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...