These are chat archives for opal/opal

3rd
Jun 2015
Vais Salikhov
@vais
Jun 03 2015 00:28
@catmando try/catch is not part of Opal AFAIK. Re calling super from self.included, please submit an issue. Re sending a PR for class_eval - awesome!
Mitch VanDuyn
@catmando
Jun 03 2015 00:29
@vais - well no big problem but isn't try/catch standard ruby? and there is a spec for it...
Vais Salikhov
@vais
Jun 03 2015 00:29
throw/catch I mean :sweat_smile:
Mitch VanDuyn
@catmando
Jun 03 2015 00:30
catch/throw I mean :-)
I think we all mean the same thing :-) point being above example runs fine in mri 1.9.3
Vais Salikhov
@vais
Jun 03 2015 00:30
yes, it is standard ruby, but that never stopped something from not being implemented in opal yet :wink:
Mitch VanDuyn
@catmando
Jun 03 2015 00:33
well its easy enough to implement (if you are not worried about performance), I will just include in the other PR. Its just odd because it seems like its in the parser and everything...
Vais Salikhov
@vais
Jun 03 2015 00:38
@catmando give it a shot!
Mitch VanDuyn
@catmando
Jun 03 2015 00:39
well already have - it is used in Acts As State Machine which I am getting working in Opal, so I already had to monkey patch it in :-)
Vais Salikhov
@vais
Jun 03 2015 03:27
@catmando PR plz
Elia Schito
@elia
Jun 03 2015 08:02
@catmando good to hear about throw/catch, I did a quick implementation some time ago but hadn't the time to finish it properly, looking forward to your PR : )
Mitch VanDuyn
@catmando
Jun 03 2015 11:10
@elia mine will also be super quick and dirty
Elia Schito
@elia
Jun 03 2015 11:12
:shipit: please do it anyway, I'll add my version to the thread and hopefully we'll come up with something meaningful
Vais Salikhov
@vais
Jun 03 2015 11:51
@catmando what @elia said, just :shipit: :)
Christian Käser
@dfyx
Jun 03 2015 13:18
@elia I've just seen a really weird problem with opal-rails (might be a general rails/sprockets problem but I don't think so)
To reproduce:
  • Use rails 4.2.1 and opal-rails 0.7.0
  • Run rake assets:precompile
  • Run rails in production
  • Visit the rails app in your browser
  • Stop rails and start it in development
  • Visit the rails app again
Result: "Opal already loaded. Loading twice can cause troubles, please fix your setup."
For some reason it loads both versions of application.js when a precompiled one exists while you're in development
Removing the precompiled assets and clearing the browser cache helped
Mitch VanDuyn
@catmando
Jun 03 2015 14:06
@elia @vais - pull requests for the instance/class/module_eval update, and catch/throw updates are in.
Elia Schito
@elia
Jun 03 2015 14:09
@catmando what's the PR number?
Mitch VanDuyn
@catmando
Jun 03 2015 14:11
:worried: I made a PR on myself... will fix sorry
Elia Schito
@elia
Jun 03 2015 14:12
ha! that explains why I wasn't able to find it :D
Mitch VanDuyn
@catmando
Jun 03 2015 14:17
yeah it seems like my master branch on the fork is way out of date, and has changes I did PRs for last year. I can start all over again, or you can just cherry pick the last two set of changes. Let me know
I don't do enough PRs to do them gracefully, sorry.
Let me know if you want me to just start over or if you can use the changes as is.
Elia Schito
@elia
Jun 03 2015 14:22
@catmando cherry pick should be fine (and easy to do)
Mitch VanDuyn
@catmando
Jun 03 2015 14:23
@elia - thanks
Elia Schito
@elia
Jun 03 2015 14:23
or alternatively you can git rebase opal/master
that should be fine to, @catmando let me know if you need any git assistance ;)
meh.
@meh
Jun 03 2015 14:58
catmando, ah snap, just commented about it in the pull request :P
Mitch VanDuyn
@catmando
Jun 03 2015 19:28
checkout the latest logo concept for opal-react opal-react
Mitch VanDuyn
@catmando
Jun 03 2015 19:46
So I have a gem I am about to publish that integrates acts-as-state-machine with opal. To use the aasm gem something needs to execute Opal.use_gem 'aasm' ... while I have been developing this, I just stuck the line in my rails application.rb file. Is there someplace this line should go in the gem so that the gem will work regardless of what is using it?
Do I just put this in the gem's .rb file like Opal.use_gem 'aasm' unless RUBY_ENGINE == 'opal'
Jamie Gaskins
@jgaskins
Jun 03 2015 19:52
@catmando I'm pretty sure there is an optimization in the parser for if RUBY_ENGINE != 'opal'. The body of that if block won't even be compiled. I don't know if using the postfix unless has the same optimization.
@catmando To actually answer your question, though, I'm pretty sure that'll still work. :-)
Elia Schito
@elia
Jun 03 2015 21:58
@catmando the logo looks great!
Mitch VanDuyn
@catmando
Jun 03 2015 22:00
@elia thanks!
Elia Schito
@elia
Jun 03 2015 22:01
@catmando @jgaskins yes it's optimized at compiler level
Mitch VanDuyn
@catmando
Jun 03 2015 22:02
but it works with unless and if right?
Elia Schito
@elia
Jun 03 2015 22:02
not sure :P
opal -Oce 'unless RUBY_ENGINE == "opal"; puts 5; end'