These are chat archives for opal/opal

12th
Jan 2018
Elia Schito
@elia
Jan 12 2018 08:22
@mistergibson can you expand a bit (an example?), I sense the solution is there but I didn't fully grasp the problem :smile:
G. Gibson
@mistergibson
Jan 12 2018 15:15
@elia : I solved it through experimentation, thanks.
Other Question: So, how do I ensure ALL the core and stdlib are always included in my .rb to .js compiles?
I want the entire enchilada to bake into the .js file - all of stdlib, etc
Elia Schito
@elia
Jan 12 2018 15:53

@mistergibson you can get all of corelib requiring opal/full after requiring opal, for the stdlib I think you have to require each file individually, links below should help:

https://github.com/opal/opal/blob/master/opal/opal.rb
https://github.com/opal/opal/blob/master/opal/opal/full.rb
https://github.com/opal/opal/blob/master/tasks/building.rake#L26 (with something like this you should be able to generate a list of files to be required)

G. Gibson
@mistergibson
Jan 12 2018 15:54
@elia : ok, thanks - good info :)
G. Gibson
@mistergibson
Jan 12 2018 16:34
So, I'm getting this error - even though I've done everything I know to do in order to effect a proper require. Details here: https://gist.github.com/mistergibson/1bf7a0cbd16a104f52ffea20e8fe00f9
Any suggestions are welcome :)
Elia Schito
@elia
Jan 12 2018 16:35
@mistergibson try with a simple require and dropping the extension: require 'native'
G. Gibson
@mistergibson
Jan 12 2018 16:36
require instead of require_relative?
Elia Schito
@elia
Jan 12 2018 16:36
yep
G. Gibson
@mistergibson
Jan 12 2018 16:36
ok - thanks, I'll try it
hrm, nope - same error
odd since I literally tell it where hike.rb is located
Elia Schito
@elia
Jan 12 2018 16:47
can you paste the new code?
G. Gibson
@mistergibson
Jan 12 2018 16:49
sure - hold on
Elia Schito
@elia
Jan 12 2018 16:53
try removing the .rb extension
just use the filename
G. Gibson
@mistergibson
Jan 12 2018 16:53
ah ok
nope , same error
Elia Schito
@elia
Jan 12 2018 17:03
@mistergibson try this:
# require 'hike'
require 'benchmark'
require 'bigdecimal'
require 'buffer'
require 'base64'
require 'console'
require 'date'
require 'delegate'
# require 'encoding'
require 'enumerator'
require 'erb'
# require 'file'
require 'fileutils'
require 'forwardable'
require 'iconv'
require 'json'
require 'js'
# require 'math'
# require 'nashorn'
require 'observer'
# require 'opal-builder'
require 'opal-parser'
require 'opal-platform'
# require 'source-maps'
require 'ostruct'
require 'pathname'
require 'pp'
require 'promise'
require 'securerandom'
require 'set'
require 'singleton'
# require 'source_map'
# require 'sourcemap'
require 'stringio'
require 'strscan'
require 'template'
require 'thread'
require 'time'
# require 'yaml'

puts "Test 1 2 3"
the commented lines should not be useful
G. Gibson
@mistergibson
Jan 12 2018 17:53
@elia : thanks, I'll try that
yeah, that worked great
first time - sweet
@elia thanks - now I see a known good on how to do it
Elia Schito
@elia
Jan 12 2018 18:09
👍🏼
G. Gibson
@mistergibson
Jan 12 2018 18:10
I don't think it loads 'corelib' though - no Marshall::dump available - I'm going to dork with it some
thanks for your help - I just found out about Opal yesterday
So don't like JS ... a hobbled language by comparison
Elia Schito
@elia
Jan 12 2018 18:11
try adding require 'opal/full' on top of everything
G. Gibson
@mistergibson
Jan 12 2018 18:11
ok
G. Gibson
@mistergibson
Jan 12 2018 18:48
I'm curious if anyone has tried opening up a websocket from within Opal ... anyone?
I have a JavaScript lib for it, but I was wondering about moving it over to Opal code.
G. Gibson
@mistergibson
Jan 12 2018 20:12
Also - does Opal make use of JavaScript co-routines? ... like soft 'fiber' implementation?
G. Gibson
@mistergibson
Jan 12 2018 21:28
@fkchang Sweet - thanks
G. Gibson
@mistergibson
Jan 12 2018 23:24
Getting odd error 'append_path' not defined for Opal : https://gist.github.com/mistergibson/bc346c3c56833b0ce7014d9c58e384df