These are chat archives for opal/opal

4th
Nov 2014
Ryan Stout
@ryanstout
Nov 04 2014 05:49
(copying in from irc) so I’m finally getting around to trying opal 0.7 on volt, I’m getting this though: Uncaught TypeError: undefined is not a function . It’s on https://github.com/opal/opal/blob/0f3b9a27cf49ac7ec265ab7b3a4a2860ac0ce334/opal/corelib/runtime.js#L51 It doesn’t see $const_missing. am I supposed to load something else in first now? on 0.7.0.beta1 - thanks
SicutDominus
@SicutDominus
Nov 04 2014 08:20
I'm just hearing about Ruby Fire, there really doesn't seem much info about it, but am I right in thinking it means I can do AngularJS type stuff wired straight into my existing Rails application?
Adam Beynon
@adambeynon
Nov 04 2014 09:39
@ryanstout ping me when you’re back online, and I’ll try and walk through to find out why that error is happening
Ryan Stout
@ryanstout
Nov 04 2014 17:42
@adambeynon you around?
Elia Schito
@elia
Nov 04 2014 20:58
@ryanstout you’re not supposed to load anything else but opal
Ryan Stout
@ryanstout
Nov 04 2014 20:58
@elia what do you mean? :-)
Elia Schito
@elia
Nov 04 2014 20:59
am I supposed to load something else in first now?
:)
@ryanstout you was just loading ‘opal.rb’ when you got the error?
Ryan Stout
@ryanstout
Nov 04 2014 21:00
the JS file it loads requires 'opal' first
but I can see that nothing is setting up $const_missing
Elia Schito
@elia
Nov 04 2014 21:01
@ryanstout it’s Module#const_missing from corelib/module.rb
Ryan Stout
@ryanstout
Nov 04 2014 21:02
let me check one thing real quick
@elia if you want to see it in action, here's the url for my test: http://69.163.83.151/
it looks like there is def.$const_missing in there, so maybe it's a load order issue
or maybe this.base isn't set right on that part
Elia Schito
@elia
Nov 04 2014 21:07
@ryanstout you’re checking for RUBY_PLATFORM before having required ‘opal’
Ryan Stout
@ryanstout
Nov 04 2014 21:07
I thought that check was in the precompilation stage?
(it worked in 0.6)
Elia Schito
@elia
Nov 04 2014 21:08
that means that, even if runtime.js is loaded, the whole corelib is missing
js files are being ran directly (runtime.js) but .rb only via require
Ryan Stout
@ryanstout
Nov 04 2014 21:09
sorry, I don't follow. So can I still use if RUBY_PLATFORM == 'opal'
Elia Schito
@elia
Nov 04 2014 21:10
it’s probably better to:
require ‘opal'
require ‘opal-jquery’ if RUBY_PLATFORM == ‘opal’
Ryan Stout
@ryanstout
Nov 04 2014 21:10
ok
let me try that I guess
Elia Schito
@elia
Nov 04 2014 21:10
that way you’ll have opal required in cruby too, but shouldn’t be a problem ;)
Ryan Stout
@ryanstout
Nov 04 2014 21:11
sweet, that fixed it
thanks!
that was easy, nice work!
just curious, what's the eta for the final version of 0.7 going out?
Elia Schito
@elia
Nov 04 2014 21:15
I guess days, @adambeynon is in bug smashing rage, let’s say a week at most
Ryan Stout
@ryanstout
Nov 04 2014 21:16
cool
a speaker dropped, so I get to talk on volt/opal at rubyconf
wanted to show off sourcemaps
Elia Schito
@elia
Nov 04 2014 21:16
woooo!
Ryan Stout
@ryanstout
Nov 04 2014 21:17
so my capybara specs all pass, but my opal-rspec's fail.
got a bunch of these: WARNING: LoadError: cannot load such file -- stringio
Elia Schito
@elia
Nov 04 2014 21:22
weird, any idea where it’s being required?
Ryan Stout
@ryanstout
Nov 04 2014 21:23
let me check one thing
I'm also seeing this: File is already part of corelib now, you don't need to require it anymore.
but it doesn't say what file
Elia Schito
@elia
Nov 04 2014 21:26

wdy mean?

but it doesn't say what file

Ryan Stout
@ryanstout
Nov 04 2014 21:26
so when running my opal-rspecs I see that message, but I'm not sure where it happens or what file it is talking about
Elia Schito
@elia
Nov 04 2014 21:27
this? warn "File is already part of corelib now, you don't need to require it anymore.”
so it shouldn’t be a problem
Ryan Stout
@ryanstout
Nov 04 2014 21:28
oh
I thought it was saying some specific file was part of corelib
:-)
Elia Schito
@elia
Nov 04 2014 21:28
maybe the message can be improved then :P
Ryan Stout
@ryanstout
Nov 04 2014 21:28
the weird thing is I don't think I am requiring it
maybe opal-jquery is?
ok, one other thing (that I think was an issue in 0.6)

if I do this:

if RUBY_PLATFORM == 'opal'
else
... some code ...
end

it works, but if I do this:

if RUBY_PLATFORM != 'opal'
 ... some code ...
end

I get Error: SyntaxError: Cannot handle dynamic require :volt/config

so it sounds like the pre-processor doesn't pickup on the !=
Elia Schito
@elia
Nov 04 2014 21:33
that’s correct, only == with if/unless/else
Ryan Stout
@ryanstout
Nov 04 2014 21:38
any chance you can add !=
oh, sorry, didn't realize unless worked
Elia Schito
@elia
Nov 04 2014 21:38
not atm, but should be quite easy
Ryan Stout
@ryanstout
Nov 04 2014 21:38
I thought it was just if
Elia Schito
@elia
Nov 04 2014 21:38
:)
Adam Beynon
@adambeynon
Nov 04 2014 21:44
I do occasionally type != as well. Should add it really
Ryan Stout
@ryanstout
Nov 04 2014 21:44
sometimes I think != is clearer
unless only reads like english in some cases (imho)
@adambeynon btw, great work on 0.7 :-)
Adam Beynon
@adambeynon
Nov 04 2014 21:46
:D
reading the above now
hows the -> 0.7 transition going
regarding opal-rspec, I think you will need to run it straight from git as well
Ryan Stout
@ryanstout
Nov 04 2014 21:48
@adambeynon I was running the beta gem, but are there updates on git?
Adam Beynon
@adambeynon
Nov 04 2014 21:49
@ryanstout yeap. There are fixes from stuff that was fixed in opal
Ryan Stout
@ryanstout
Nov 04 2014 21:49
ok, let me try that
Adam Beynon
@adambeynon
Nov 04 2014 21:49
really need to release another beta gem, but git/master is pretty sturdy
also, awesome news on rubyconf (Y)
Ryan Stout
@ryanstout
Nov 04 2014 21:49
thanks, I'll talk up opal :-)
dumb question, I'm using opal-rspec to test volt, if I put the git repo in the Gemfile, do I need to remove it from the gemspec?
Adam Beynon
@adambeynon
Nov 04 2014 21:51
dont think so. I always assumed a gemfile entry would override a gemspec
that might be completely false though ^_-
Ryan Stout
@ryanstout
Nov 04 2014 21:52
I'll try it :-)
Adam Beynon
@adambeynon
Nov 04 2014 21:52
@ryanstout the github repo is on the same version as the latest gem though, so it shouldnt cause versioning issues
Ryan Stout
@ryanstout
Nov 04 2014 21:52
ok
Ryan Stout
@ryanstout
Nov 04 2014 22:00
@adambeynon or @elia so I've got a weird issue running specs, I was hoping maybe you guys might have an idea. Basically, I've got this file loading: https://github.com/voltrb/volt/blob/opal7/lib/volt/reactive/computation.rb with opal-rspec and it's giving me: NameError: uninitialized constant Volt::Computation from line 119
but that's loaded before that
Adam Beynon
@adambeynon
Nov 04 2014 22:03
@ryanstout very strange. I just tried it locally and it works..
Ryan Stout
@ryanstout
Nov 04 2014 22:03
really?
Adam Beynon
@adambeynon
Nov 04 2014 22:03
@ryanstout is the github repo up to date?
Ryan Stout
@ryanstout
Nov 04 2014 22:03
just on that file?
yea
pull it and run: bundle exec rake
it runs in mri, then opal
(it's on that branch)
Adam Beynon
@adambeynon
Nov 04 2014 22:05
@ryanstout obviosuly I have to uncomment the opal gems so they come from github
just checking your not using adambeynon/opal-rspec instead of opal/opal-rspec
Gemfile lists it as adambeynon/...
Ryan Stout
@ryanstout
Nov 04 2014 22:06
^ try the opal7 branch
I do need to cleanup that gemfile though :-)
but branch opal7 has the right stuff in there
Adam Beynon
@adambeynon
Nov 04 2014 22:08
ahhh, I see
got it
but yes, seeing that same issue
Ryan Stout
@ryanstout
Nov 04 2014 22:10
it's weird because if I uncomment line 119, it gives me different errors
(so thats where the first error is)
also, everything runs fine in the browser
(well, my capybara tests at least, but it definitely loads right in the browser)
Adam Beynon
@adambeynon
Nov 04 2014 22:14
@ryanstout inside computation_spec.rb, If I manually require volt/reactive/computation then it works
but complains dependency is missing
it must not be loading those files for some reason
well, not requiring them
Ryan Stout
@ryanstout
Nov 04 2014 22:14
then why does commenting the stuff in class Proc change things?
Adam Beynon
@adambeynon
Nov 04 2014 22:15
dont know.. still trying to work it out
Ryan Stout
@ryanstout
Nov 04 2014 22:15
thanks
Adam Beynon
@adambeynon
Nov 04 2014 22:15
so, the specs now run If I require those two files inside computation_spec.rb
some failures
Ryan Stout
@ryanstout
Nov 04 2014 22:16
humm, weird
maybe some load order issue?
not sure how that would happen
Adam Beynon
@adambeynon
Nov 04 2014 22:16
dont know. we are using “real” requires now, so hopefully the order should be sorted automatically
111 examples, 24 failures
Ryan Stout
@ryanstout
Nov 04 2014 22:17
ok, let me mess around with it a bit and see what I can find. thanks!
Adam Beynon
@adambeynon
Nov 04 2014 22:17
expected: "html_tidy"
got: "\1_\2dy"
Ryan Stout
@ryanstout
Nov 04 2014 22:17
it's weird, it all worked in 0.6
Adam Beynon
@adambeynon
Nov 04 2014 22:17
looks like there are perhaps some regressions on regexps
Ryan Stout
@ryanstout
Nov 04 2014 22:17
humm, I'm not using regex's much
Adam Beynon
@adambeynon
Nov 04 2014 22:17
thats coming from #camelize specs
Ryan Stout
@ryanstout
Nov 04 2014 22:17
oh, I guess on that one
humm
yea, that one was passing
Adam Beynon
@adambeynon
Nov 04 2014 22:18
setImmediate is not defined
thats popping up a few times too
Ryan Stout
@ryanstout
Nov 04 2014 22:18
humm
I'll try adding the requires and see if I can fix the others
Adam Beynon
@adambeynon
Nov 04 2014 22:18
infact, setImmediate and the camelize method are the only failures
It took me 3 or 4 days to get my last app onto 0.7
so not too bad ;)
Ryan Stout
@ryanstout
Nov 04 2014 22:19
yea, all of my capybara tests passed right away (once I got one thing fixed)
which is pretty awesome
that basically means it all works in the browser
did you switch the way opal-rspec runs tests?
is it using node now?
(instead of phantom)
Adam Beynon
@adambeynon
Nov 04 2014 22:21
ahh, I added a config.ru to run the specs inside a browser - easier to debug errors
when I run through the rake task, setImmediate errors dont show up
Ryan Stout
@ryanstout
Nov 04 2014 22:22
actually, I think maybe it has to do with my spec_helper
for some reason I wasn't running Volt.spec_setup in opal
not sure how that worked in 0.6
that takes me down to 4 issues which are all regex
Adam Beynon
@adambeynon
Nov 04 2014 22:23
sweet
Ryan Stout
@ryanstout
Nov 04 2014 22:23
let me push that up
pushed
so I guess that regex issue is the only regression
(that my tests found, hehe)
want me to make an issue for the regex?
Adam Beynon
@adambeynon
Nov 04 2014 22:25
please
yeap ^^ must have happened farily recently
:(
Ryan Stout
@ryanstout
Nov 04 2014 22:27
opal/opal#646
Ryan Stout
@ryanstout
Nov 04 2014 22:43
@adambeynon or @elia so I'm working on my rubyconf talk, are there any benchmarks comparing opal to straight JS?
Adam Beynon
@adambeynon
Nov 04 2014 22:46
the benchmarks looks very good when we enable inlined operators
but I was overuled about having them on by default :(
Ryan Stout
@ryanstout
Nov 04 2014 22:52
would you send me some urls for benchmarks? (with inline operators is fine :-)
Adam Beynon
@adambeynon
Nov 04 2014 23:22
@ryanstout okay, that should be sorted now on master
still need to fix some specs for it though
Ryan Stout
@ryanstout
Nov 04 2014 23:25
the regex issue?
cool, thanks
ok, running master fixed the regex, but broke two others :-)
I'll track it down
Ryan Stout
@ryanstout
Nov 04 2014 23:34
@elia had a question about sourcemaps if your around
Adam Beynon
@adambeynon
Nov 04 2014 23:34
ughh
@ryanstout regexp related?
Ryan Stout
@ryanstout
Nov 04 2014 23:34
no
object_id related maybe?
or maybe equality
might take me a little while to track it down
I can push it up if your curious
Adam Beynon
@adambeynon
Nov 04 2014 23:35
ok, sure. I will look tomorrow though, its too late for me :)
push it up though
I will tackle it in the monring
morning*
Ryan Stout
@ryanstout
Nov 04 2014 23:37
pushed. I can try to track it down more. Thanks
thanks for all of your help. Really a pretty seamless transition