These are chat archives for opal/opal

16th
Dec 2015
Sam Joseph
@tansaku
Dec 16 2015 14:01
hi all - I'm looking at https://github.com/opal/opal.github.io and I've got it running locally - I'm particularly interested in the try component, but I notice that try.js and try_opal are all minified. I was hoping to look at the unminified versions to see how it all works ... does anyone know if those are available somewhere?
Elia Schito
@elia
Dec 16 2015 14:03
@tansaku the source for the minified code is here: https://github.com/opal/opal.github.io/tree/source/source/javascripts (branch source)
Sam Joseph
@tansaku
Dec 16 2015 14:03
@elia - oh cool thanks! :-)
Elia Schito
@elia
Dec 16 2015 14:03
also you can have a look at opal-playground by @fkchang : https://github.com/fkchang/opal-playground
which has more features I think
Sam Joseph
@tansaku
Dec 16 2015 14:04
nice one - I'll check that out :-)
Sam Joseph
@tansaku
Dec 16 2015 14:11
@elia I'm trying to run bundle on the source branch and I get various "Bundler could not find compatible versions for gem "sprockets":" do you know which version of ruby I should be using?
Elia Schito
@elia
Dec 16 2015 14:12
@tansaku eh, alas the code there needs some serious update and probably a switch to the latest (beta) version of middleman
Sam Joseph
@tansaku
Dec 16 2015 14:13
thanks - I'll try bundle update
Elia Schito
@elia
Dec 16 2015 14:13
should work with the latest 2.2.3 anyway
here's the Gemfile from another middleman site I maintain that should be quite up to date
Sam Joseph
@tansaku
Dec 16 2015 14:15
thanks
Elia Schito
@elia
Dec 16 2015 14:16
:+1:
Sam Joseph
@tansaku
Dec 16 2015 14:16
so that branch is not actually the one deployed at http://opalrb.org/ ?
Elia Schito
@elia
Dec 16 2015 14:16
the source branch is used to generate the master branch which holds the code on opalrb.org
Sam Joseph
@tansaku
Dec 16 2015 14:17
right, ah, but it hasn't been generated recently ...
I copied over the middleman gem things from that Gemfile, and bundle now runs but I can't run middleman - I get this error:
this is how the Gemfile currently looks: https://gist.github.com/tansaku/40b8c29e5e101a7d3787
Elia Schito
@elia
Dec 16 2015 14:20
try upgrading opal-rspec as well
Sam Joseph
@tansaku
Dec 16 2015 14:21
It's currently pulling off github ...
Elia Schito
@elia
Dec 16 2015 14:22
opal-rspec uses submodules so it needs submodule: true in the gem file
Sam Joseph
@tansaku
Dec 16 2015 14:22
@elia if I remove the github links I from the opal components I get this error: https://gist.github.com/tansaku/6b1012dfe761b81d79f6
ah
submodule: true
Elia Schito
@elia
Dec 16 2015 14:22
the released opal-rspec 0.5 should work fine too btw
Ilya Bylich
@iliabylich
Dec 16 2015 14:23
@elia Why does arity checking is disabled by default?
Elia Schito
@elia
Dec 16 2015 14:23
is expensive in terms of performance so the idea is to disable it in production code but keep it in dev
that's at least what should be happening in opal-rails
Sam Joseph
@tansaku
Dec 16 2015 14:24
thanks @elia have added gem 'opal-rspec', :github => 'opal/opal-rspec', :submodules => true
but still get /Users/tansaku/.rvm/gems/ruby-2.2.3/gems/middleman-core-4.0.0/lib/middleman-core/extensions.rb:86:in 'load': Unknown Extension: syntax. Check the name and make sure you have referenced the extension's gem in your Gemfile. (RuntimeError)
Elia Schito
@elia
Dec 16 2015 14:26
@tansaku it probably it has to do with the upgraded middleman, I guess something changed in the config api, try looking into middleman docs… https://middlemanapp.com/basics/upgrade-v4/
Sam Joseph
@tansaku
Dec 16 2015 14:26
@elia will do - many thanks for your help
Elia Schito
@elia
Dec 16 2015 14:27
thanks to you! please remember to send a pull-request if you manage to get it working :)
Sam Joseph
@tansaku
Dec 16 2015 14:27
sure will :-)
Ilya Bylich
@iliabylich
Dec 16 2015 14:32
And how can I enable it for opal-repl without patching it? Seems it doesn't take any arguments except of the filename
Elia Schito
@elia
Dec 16 2015 14:35
eh, opal-repl needs some love
long run my plan was to add an opal-irb running the real thing
Sam Joseph
@tansaku
Dec 16 2015 15:04
@elia I notice the Gemfile.lock is not in the source branch - you don't happen to have an old copy of that lying around do you?
Elia Schito
@elia
Dec 16 2015 15:04
let me check
Sam Joseph
@tansaku
Dec 16 2015 15:05
thanks
aha - just got it working by removing the github links from the opal* gems
Elia Schito
@elia
Dec 16 2015 15:06
w00t
Sam Joseph
@tansaku
Dec 16 2015 15:19
there's a Document.ready? do $stdout.write_proc = $stderr.write_proc = proc do |str| TryOpal.instance.print_to_output(str) end TryOpal.instance.run_code end but I assume that only runs on document load
just trying to work out how try_opal.rb updates that
sorry, my connection went and I lost some messages there
I was saying I can send a pull request for that @elia , and I'm trying to work out how try_opal.rb updates the output pane ...
Jose Añasco
@merongivian
Dec 16 2015 21:36
Hey everyone , is there a way to tail call optimize opal code ?
Jared White
@jaredcwhite
Dec 16 2015 21:37
@catmando and the rest of the ReactRB team - congrats on the release! Very exciting stuff, which I'll need to check out in due course
Mitch VanDuyn
@catmando
Dec 16 2015 21:38
Thanks!
Elia Schito
@elia
Dec 16 2015 21:45
@merongivian not very expert in TCO but I think you can try manipulating the AST
Jose Añasco
@merongivian
Dec 16 2015 21:47
@elia im not an expert on AST either :tongue:
Elia Schito
@elia
Dec 16 2015 21:47
eheheh
it's probably easier than it seems, a good place to start is maybe outputting it with --sexp from the CLI
eg opal --sexp -e 'def fact(n, acc=1) return acc if n <= 1; fact(n-1, n*acc) end'
Elia Schito
@elia
Dec 16 2015 21:56
(code taken from here: http://nithinbekal.com/posts/ruby-tco/)
Jose Añasco
@merongivian
Dec 16 2015 22:00
@elia I have to learn more about parsers i, guess, so as far as i umderstand in order to make the tail optimization i have to convert my code in to a loop, which in case of javascript/opal will froze the browser since i will have to use while(true)
Which is what opal uses for the loop implementation
So either way im screwed
Elia Schito
@elia
Dec 16 2015 22:04
:)
would be interesting to see whats the MRI implementation
Hahaha sorry is the same post u sent
Elia Schito
@elia
Dec 16 2015 22:09
:D