These are chat archives for opal/opal

16th
Aug 2015
Colin Gunn
@balmoral
Aug 16 2015 08:34
@bbatsov excellent presentation :+1:
Dexter Tzu
@dextertzu
Aug 16 2015 14:07
does anyone know of any good opal documentation/tutorials ?
meh.
@meh
Aug 16 2015 14:16
@vais @elia ping
Elia Schito
@elia
Aug 16 2015 14:22
@meh pong
meh.
@meh
Aug 16 2015 14:22
I'm getting a cannot load such file -- racc/parser.rb when running specs on my bridging-redux branch
and why is it needed by the tests?
what could cause that?
Elia Schito
@elia
Aug 16 2015 14:23
@danny-tang @astonj has a good list of materials
meh.
@meh
Aug 16 2015 14:25
elia, trying from opal-repl it requires it with no problem
mh
looks like it's requiring racc/parser.rb instead of racc/parser
Elia Schito
@elia
Aug 16 2015 14:27
👍🏼
meh.
@meh
Aug 16 2015 14:27
in the grammar bullcrap, let's see if fixing that fixes it in the specs
kinda
another error now
ah
right
meh.
@meh
Aug 16 2015 14:47
well, shit is running, that's something
and now it's probably in an infinite recursion
@elia is there a way to get the reason of failures/errors printed before finishing to run all the specs?
or a way to figure out which spec is getting stuck so I can kill it
or something
or to run just a group of specs
Elia Schito
@elia
Aug 16 2015 15:57
Sorry AFK, you can pass a PATTERN env to run select specs
meh.
@meh
Aug 16 2015 15:59
yeah, I saw
any way to run the specs in chrome?
need a debugger
Elia Schito
@elia
Aug 16 2015 16:00
try rackup
meh.
@meh
Aug 16 2015 16:01
bundle exec rackup?
seems to be doing something, we'll see
yeah, noice
thanks
Elia Schito
@elia
Aug 16 2015 16:02
or rake mspec:specs:build or something like that should build a static js
meh.
@meh
Aug 16 2015 16:03
nah, rackup is doing its job
now the painful part
Qqwy / Wiebe-Marten
@Qqwy
Aug 16 2015 17:38
I have a question: Is there a nice way to use setTimeout and setInterval using Opal?
George Plymale II
@ylluminarious
Aug 16 2015 17:44
@Qqwy try $$.setInterval or $$.setTimeout
Bernhard Weichel
@bwl21
Aug 16 2015 17:49
@ylluminarious what is $$? why does this work?
George Plymale II
@ylluminarious
Aug 16 2015 17:51
@bwl21 i'm pretty sure it's just the window object, but i'll have to look at opal's source to be sure
Qqwy / Wiebe-Marten
@Qqwy
Aug 16 2015 17:56
Wow, that's amazing! Good to know that $$ points to the window object
def setTimeout(time, &block)
  $$.setTimeout(block, time)
end

puts "starting"

setTimeout(3000) do 
  puts "hugo"
end
George Plymale II
@ylluminarious
Aug 16 2015 18:06
@bwl21 nice
Bernhard Weichel
@bwl21
Aug 16 2015 18:11
found an answer how to get the methods / keys of a Native - object? I have the example in

a=%x{
  {"foo": "bar", "next": "this is next"}
}

b = Native(a)

puts %x{Object.keys(#{b.to_n})}
is there a better solution for this?
Samuel Gaus
@gausie
Aug 16 2015 18:45
hey i'm trying to write an implementation of an unimplemented stdlib for Opal. Is it acceptable for it to depend on a third-party library and if so how is it best to "require" it?
meh.
@meh
Aug 16 2015 18:48
gausie, acceptable for inclusion in Opal?
Samuel Gaus
@gausie
Aug 16 2015 18:54
yeah
currently trying to implement Shellwords
against the spec
meh.
@meh
Aug 16 2015 18:55
gausie, eeh, we'd rather not have third-party libs inside Opal, unless it's really really required
Samuel Gaus
@gausie
Aug 16 2015 18:56
*in regex even :P
well shellwords requires some complex parser logic because javascript doesnt support lookbehinds in javascript
it's probably doable without
it would just be a lot harder
meh.
@meh
Aug 16 2015 18:57
how big would the dependency be? and what's its license?
Samuel Gaus
@gausie
Aug 16 2015 18:59
there are a number to choose from, and i havent started actually using one yet. i've just been meeting unit tests and hit a wall.
meh.
@meh
Aug 16 2015 19:01
gausie, the biggest concerns are license compatibility and unused code from the third party library
Samuel Gaus
@gausie
Aug 16 2015 19:02
understood
i'll keep working on it anyway
without a librat
*library
another one that i was thinking of working on that would hugely benefit from a library instead of implementation from scratch is REXML
Forrest Chang
@fkchang
Aug 16 2015 22:16
@Qqwy you can make it more rubyesque like this http://funkworks.blogspot.com/2015/04/ruby-fying-javascript-timeout.html
opal browser also wraps timeout and interval
Qqwy / Wiebe-Marten
@Qqwy
Aug 16 2015 22:35
@fkchang: Thank you!