These are chat archives for opal/opal

24th
Jul 2016
Keenan Brock
@kbrock
Jul 24 2016 20:10
Is it possible that requre has slightly different scoping between the various versions?
I'm trying to upgarde someone else's opal ruby robot project, and I noticed that I now am requiring a include ::Robotwhen the old code worked fine with include Robot (a global scope symbol)
[ref]
Jamie Gaskins
@jgaskins
Jul 24 2016 20:58
@kbrock Looks like it might be some weirdness in scoped constant lookup. Is this the git ref for the Opal version you're using?
Keenan Brock
@kbrock
Jul 24 2016 20:59
yes, that version looks up Robot correctly
my end goal is to bring this up to date with opal
use it as a learning exercise
... clearwater ...
anyway
Jamie Gaskins
@jgaskins
Jul 24 2016 21:00
lol Cool, lemme have a look
Keenan Brock
@kbrock
Jul 24 2016 21:00
@jgaskins yes, that version works correctly, when I go to master, it says import Robots ==> NervousDuck::Robots not found
I tried to tear everything out (including ugly Native calls) to get this as minimal use of browser as possible
want to transistion to bowser
this code base is probably too complex for a starter project. I should go back to conway or something ;)
Jamie Gaskins
@jgaskins
Jul 24 2016 21:14
It looks like it's fetching gists, compiling them to JS, and then evaling that. I'm not sure what could be going wrong, but I have a feeling it's the eval that's causing trouble.
Screen Shot 2016-07-24 at 5.14.20 PM.png
I mean, it's obvious from the stack trace that the problem is within the eval, but I mean I think the eval itself may be problematic.
Keenan Brock
@kbrock
Jul 24 2016 21:17
aah
I'll try and come up with a simpler example
(so I can understand too)
but in the end, I'm pretty sure it is the import Robots line that is the problem
maybe I'll step through opal versions to see where it works and breaks
@jgaskins thanks for all the help
Jamie Gaskins
@jgaskins
Jul 24 2016 21:18
I know I've used include X before in evaled code, but that was a version or two ago.
No worries
Keenan Brock
@kbrock
Jul 24 2016 21:19
I'm pretty sure include ::Robots works
it is as if it doesn't do scopes correctly
Jamie Gaskins
@jgaskins
Jul 24 2016 21:19
Yeah, that's what makes me wonder if the eval is broken. I'm wondering if the lexical scoping is messed up somehow.
Keenan Brock
@kbrock
Jul 24 2016 21:22
perfect, I'll see if I can get a 20 liner working.
Elia Schito
@elia
Jul 24 2016 21:24
@kbrock at some point require transitioned from preprocessor (similar to sprockets requires) where a require was translated into a direct file inclusion at the top, to a full-fledged module system that allowed for semantics nearly identical to MRI – dunno if this info helps, let me know if you want more deatils, I think the change happened between 0.6 and 0.7
also eval scoping ain't perfect yet :)
@/all anyone ever used yaml from the stdlib? – I think I'll remove it from there, the change will require to go from require 'yaml' to require 'nodejs/yaml'
(the reason is this jshint bug: jshint/jshint#2949 :sweat_smile:)
Guillaume Grossetie
@Mogztter
Jul 24 2016 21:38
I think I've never used yaml
Elia Schito
@elia
Jul 24 2016 21:48
yeah, I added that a while ago when I did some experiments with nwjs and the electron predecessor