These are chat archives for opal/opal

14th
Apr 2016
Brady Wied
@wied03
Apr 14 2016 15:26
@iliabylich @elia - You guys know how to keep Opal from adding stubs to non Opal classes/methods? https://gist.github.com/wied03/940e70dcf9da0f3095326e2dfb912381
Ilya Bylich
@iliabylich
Apr 14 2016 15:27
@weid03 Function is a proc :smile: That's an Opal class
Brady Wied
@wied03
Apr 14 2016 15:28
yep, but any way to be more selective about how we apply it ?
i have some code that's pure JS that uses $inject as a function name and it's getting overwritten
I suppose I could save off the function before requiring opal and restore it, but was curious if there is a better way
I don't really want to turn off method_missing entirely either :(
Ilya Bylich
@iliabylich
Apr 14 2016 15:34
Actually don't even know what to say. That's a common problem of conflicting libraries
Probably the easiest way here is to save and restore your original function
Or you can try to add some code to Opal.add_stubs that applies a stub only if it wasn't registered in some global pool of exceptional methods
But I'd say it also looks bad :smile:
Brady Wied
@wied03
Apr 14 2016 15:37
exceptional methods. they're so good they can't be stubbed ;)
so many cheesy puns that can be done there, I'll spare you
Brady Wied
@wied03
Apr 14 2016 16:03
@iliabylich is not even laughing. can't say I blame you. lame jokes. anyways, thanks for being a sounding board
Ilya Bylich
@iliabylich
Apr 14 2016 16:25
@wied03 :+1:
Elia Schito
@elia
Apr 14 2016 20:01
@wied03 you can disable method missing if that's viable
@wied03 is it angular, I remember it used to use properties starting with $
Brady Wied
@wied03
Apr 14 2016 20:04
yeah, but that's all or none, and i don't want to do that
and the opal compiler, which is the code that's "overwriting", relies on method_missing in a few spots I think
not angular. it's Karma. and since Karma with this webpack loader loads the opal compiler in node, the method gets overwritten
I might just have to monkey patch Compiler#method_calls to exclude inject from its list
Elia Schito
@elia
Apr 14 2016 20:10
you can also var original_add_stubs = Opal.add_stubs; Opal.add_stubs = function(args){/*exclude stuff from args*/; original_add_stubs(args) };
that patch should go after requiring corelib/runtime.js
Brady Wied
@wied03
Apr 14 2016 20:21
that's a good idea