These are chat archives for opal/opal

17th
Aug 2015
meh.
@meh
Aug 17 2015 13:45
@vais when you have time take a look at the numeric-redux branch please
Jared White
@jaredcwhite
Aug 17 2015 15:42
@fkchang I use a similar convention in my code (aka Timeout.new(500) do). Love it :)
Forrest Chang
@fkchang
Aug 17 2015 16:53
@jaredcwhite it just makes sense to "rubyfy" it, OO is your friend
Forrest Chang
@fkchang
Aug 17 2015 19:07
@elia ping
Elia Schito
@elia
Aug 17 2015 19:13
@fkchang pong
meh.
@meh
Aug 17 2015 19:30
@elia can you check if the bridging-redux stuff works with opal-jquery?
I think it's the only user of bridging outside core
if that works I'm gonna merge it
Elia Schito
@elia
Aug 17 2015 19:32
Yesterday I did a quick check on opalrspec and seemed to block the execution but lacked the time to go deeper
@meh I'lol try on jq but probably not before 2hrs
lol 'twas I'll
meh.
@meh
Aug 17 2015 19:35
elia, there's time, just finished making Rational fully compliant, Complex is next
Elia Schito
@elia
Aug 17 2015 19:35
cool
meh.
@meh
Aug 17 2015 19:41
elia, but really, that bug should be unrelated in opal-rspec
if the specs pass stuff must be working in this case
it's something so basic and deep that it would break everything
as in, the specs wouldn't even run in the first place
Forrest Chang
@fkchang
Aug 17 2015 19:50
@elia opal-haml question, if you use the :opal section, string interpolation uses the view/controller variables and not the opal variables. Is there a way to do opal interpolation? i.e.
:opal
  date = Date.now
  "The date is #{date}" # error is no date method or variable, which there is none in the view/controller
I can concatenate the string myself, but a surprise
Elia Schito
@elia
Aug 17 2015 19:53
Meh, yeah need to check it works on master, tbh don't remember if I tried that first
Elia Schito
@elia
Aug 17 2015 20:01
@fkchang kids bedtime, will check your question later when I actually able to understand;)
meh.
@meh
Aug 17 2015 20:05
isNaN(undefined)
false
true
for the love of god why
isNaN(null)
Elia Schito
@elia
Aug 17 2015 20:47
Number.isNaN = Number.isNaN || function(value) {
    return typeof value === "number" && isNaN(value);
}
meh.
@meh
Aug 17 2015 20:48
I know, I worked around it
it's still pants on head retarded
well, looks like I fixed a bunch of numeric bugs as well
you're broken travis
elia @elia is laughing
meh.
@meh
Aug 17 2015 20:50
it's failing the rspec stuff
dunno why
Elia Schito
@elia
Aug 17 2015 20:50
lemme check
meh.
@meh
Aug 17 2015 20:50
and looking at that link is killing my browser
Elia Schito
@elia
Aug 17 2015 20:53
btw opal-jquery:
TypeError: 'undefined' is not an object (evaluating 'ancestor.$$super')
meh.
@meh
Aug 17 2015 20:54
ah
elia, can you quickly setup a static html/js file I can feed chrome?
also it's a weird spec that was checking for something unrelated which I just added to math.rb
I think at least
yeah
kek
come on, who wrote that spec
elia, it's all your fault
Elia Schito
@elia
Aug 17 2015 20:58
:sweat:
       Diff:
       @@ -1,2 +1,33881 @@
       -5\n
       +(function(undefined) {
       +  if (typeof(this.Opal) !== 'undefined') {
       +    console.warn('Opal already loaded. Loading twice can cause troubles, please fix your setup.');
       +    return this.Opal;
       +  }
       +
meh.
@meh
Aug 17 2015 20:59
I just ran the rspec specs locally and it works, why is it still broken
ah no, it was another commit
everything is right
Elia Schito
@elia
Aug 17 2015 21:00
somehow's outputting the contents of the script instead of "5\n"
meh.
@meh
Aug 17 2015 21:00
elia, no no, it was checking the output
but it was testing for nowhere in the output to be a 5\n
and I had to add some constants in Math
and one ended with 5\n
Elia Schito
@elia
Aug 17 2015 21:01
heh, weak test
@fkchang "asdfasdfsa \#{date} asdfdasf" should work
notice the escape backslash
meh.
@meh
Aug 17 2015 21:04
there
Elia Schito
@elia
Aug 17 2015 21:10
this is the opal-rspec code that is broken with bridging-redux (and makes opal-jquery specs fail)
module Marshal
  class << self
    # Duplicates any mock objects before serialization. Otherwise,
    # serialization will fail because methods exist on the singleton class.
    def dump_with_mocks(object, *rest)
      if ::RSpec::Mocks.space.nil? || !::RSpec::Mocks.space.registered?(object) || NilClass === object
        dump_without_mocks(object, *rest)
      else
        dump_without_mocks(object.dup, *rest)
      end
    end

    alias_method :dump_without_mocks, :dump
    undef_method :dump
    alias_method :dump, :dump_with_mocks
  end
end
the offending line is alias_method :dump_without_mocks, :dump
meh.
@meh
Aug 17 2015 21:11
and the error was?
Elia Schito
@elia
Aug 17 2015 21:11
apparently obj.$$super in Opal.alias is undefined
thus the subsequent while dies
meh.
@meh
Aug 17 2015 21:11
I think I know the problem
Elia Schito
@elia
Aug 17 2015 21:12
trying to get ancestor.$$super
meh.
@meh
Aug 17 2015 21:12
elia, basically, our alias before didn't afraid of anything
elia, check if there is a #dump method in the first place
Elia Schito
@elia
Aug 17 2015 21:12
I see
meh.
@meh
Aug 17 2015 21:12
since we lack marshalling
that may be the issue
the error is dumb tho, I'll fix that
it should just raise if it can't find it
Elia Schito
@elia
Aug 17 2015 21:13
indeed: NameError: undefined method `dump' for class `Class'
meh.
@meh
Aug 17 2015 21:15
should be as easy as adding a dummy marshal module
if we don't have one already
Elia Schito
@elia
Aug 17 2015 21:15
:+1:
meh this raises an old question
should such a module go to stdlib (being a stub) or in corelib as in MRI?
defining self.dump(*) is enough to make opal-jquery specs pass
meh.
@meh
Aug 17 2015 21:20
elia, good question
I have no idea :D
I think
we should just have a nice unsupported.rb in core
and put all the unsupported core stuff there
including the String business
Elia Schito
@elia
Aug 17 2015 21:22
if we had a stripped down version kinda like mruby it would be a nobrainer as one can choose it and cherry pick the stuff he really needs
meh.
@meh
Aug 17 2015 21:22
elia, well, it's already possible
most things are cherry-pickable from opal
we just have to publicize the fact
I'll take care of it
after I'm done with these numeric failures
Elia Schito
@elia
Aug 17 2015 21:23
deal :)
Elia Schito
@elia
Aug 17 2015 21:29
"just write vanilla JS"… of course
Forrest Chang
@fkchang
Aug 17 2015 21:31
@elia thx
meh.
@meh
Aug 17 2015 21:31
I hate these specs with all my heart
fucking coercion
sometimes it should raise an ArgumentError
this is retarded
sometimes a TypeError
Elia Schito
@elia
Aug 17 2015 21:32
@fkchang feel free to send a PR to update the README ;)
Forrest Chang
@fkchang
Aug 17 2015 21:32
@elia can do
Elia Schito
@elia
Aug 17 2015 21:33
repo is opal-rails
meh.
@meh
Aug 17 2015 21:52
elia, is there a way to just run a group of specs?
with PATTERN I have to specify every file
Elia Schito
@elia
Aug 17 2015 21:53
I think it accepts globs
meh.
@meh
Aug 17 2015 21:57
I think I tried but it failed some fixtures
Elia Schito
@elia
Aug 17 2015 21:58
Checking
meh.
@meh
Aug 17 2015 21:59
might have been just the stuff I was trying to test tho
Elia Schito
@elia
Aug 17 2015 22:01
PATTERN is passed to Dir.[] in rake mspec_node
meh.
@meh
Aug 17 2015 22:01
PATTERN="spec/rubyspec/core/numeric/*"
guess I need *_spec.rb
yep
all good
Elia Schito
@elia
Aug 17 2015 22:02
I'll update the CONTRIBUTING.md instructions and the desc
meh.
@meh
Aug 17 2015 23:49
@elia you there?
guess not