These are chat archives for opal/opal

25th
Jun 2015
Forrest Chang
@fkchang
Jun 25 2015 03:02
@jaredcwhite hope you feel better, got my submission in, just under the wire
Forrest Chang
@fkchang
Jun 25 2015 03:20
@adambeynon @elia @meh what exactly do you guys mean by 'toll free bridged class' ?
Jared White
@jaredcwhite
Jun 25 2015 03:52
@fkchang Yep, feeling better today, thanks. Got your submission! Issue's going out in the morning. Good night folks :)
Adam Beynon
@adambeynon
Jun 25 2015 05:44
@fkchang Array, String etc which are just instances of the JavaScript equivalents. Objects which we just use and extend rather than wrapping
Forrest Chang
@fkchang
Jun 25 2015 16:19
@adambeynon ok, so when opal-jquery says that Element is a toll free bridged class by doing
class Element < `#{JQUERY_CLASS.to_n}`
What it means is that you're extending JQUERY_CLASS via the above line?
Adam Beynon
@adambeynon
Jun 25 2015 16:21
@fkchang Yeap. If you pass a javascript class (i.e. just a Function) as a superclass, then we extend the function prototype and make it toll free
We then mix in all methods from Object and Kernel
and any future method defined on Object and Kernel get added to it as well
but do bare in mind, we also treat it as a method_missing target, so we adds all those dummy methods to its prototype so method_missing works on it like any other ruby object
Forrest Chang
@fkchang
Jun 25 2015 16:24
@adambeynon ok, so side effect is I can now call $<blah> opal methods off of $ in js
Elia Schito
@elia
Jun 25 2015 16:25
I do that all the time
Forrest Chang
@fkchang
Jun 25 2015 16:25
interesting
Forrest Chang
@fkchang
Jun 25 2015 16:37
while I have @adambeynon and @elia online, how is $$ defined? because
$$ == `window` # true
$$[:jQuery] # works
`window`[:jQuery] # fails no method []
$$ != Native(`window`) # true, but
Native(`window`)[:jQuery] works
Elia Schito
@elia
Jun 25 2015 16:38
$$ is Native(`Opal.global`)
which in the browser is window of course
Forrest Chang
@fkchang
Jun 25 2015 16:39
also what terminology do we use for what's returned by x strings, I want to say native, but it's not the same as what's returned by Native()
Elia Schito
@elia
Jun 25 2015 16:39
I think $$ != Native(`window`) is a bug
meh.
@meh
Jun 25 2015 16:53
sounds like a bug indeed
gonna fix that
Rick Carlino
@RickCarlino
Jun 25 2015 16:54
So $$ is an interface to native JS functions? Does it allow dot notation, also?
Had no idea, that's really cool.
meh.
@meh
Jun 25 2015 16:55
RickCarlino, $$ is a Native::Object
Rick Carlino
@RickCarlino
Jun 25 2015 16:55
I will have to play around with that one. Nice.
meh.
@meh
Jun 25 2015 17:06
elia, fkchang, I retract that, I don't understand why $$ != Native(window)
unless our != compilation is broken
Forrest Chang
@fkchang
Jun 25 2015 17:18
@meh might it be a 0.7 vs 0.8 diff?
actually, maybe it was a fat finger of mine
meh.
@meh
Jun 25 2015 17:19
fkchang, I don't know, the implementation of Native::Object#== is very straightforward
#@native === #{Native.try_convert(other)}
Forrest Chang
@fkchang
Jun 25 2015 17:20
@meh lemme see if I can recreate what made me think there was a problem
@meh @elia ok, looks like I was wrong about $$ != Native(window),
meh.
@meh
Jun 25 2015 17:23
cool
Ryan Stout
@ryanstout
Jun 25 2015 18:55
I saw somewhere that Time.parse is in stdlib, how do I require it in
meh.
@meh
Jun 25 2015 19:45
ryanstout, require 'time'
if it's implemented
I don't remember if it is, I know Date.parse is