These are chat archives for opal/opal

8th
Jul 2015
Forrest Chang
@fkchang
Jul 08 2015 00:04 UTC
@meh so what's an example where you want to the extend the native class prototype?
it's when you do not want to that matters
for example in IE6..8 extending the DOM would cause an exception
Forrest Chang
@fkchang
Jul 08 2015 00:08 UTC
@meh then it would seem that there's no advantage to toll free bridging. include Native seems to be across the board safer, unless you are wanting to call opal methods off of native js objects. Is there any performance benefits?
from my tests there's no meaningful overhead between wrapping and extending
Forrest Chang
@fkchang
Jul 08 2015 00:11 UTC
@meh any history to the name "toll free" bridging? It would seem to imply that include Native is "toll required" bridging, to which I ask, "what is the toll?"
though I think toll free bridging is done on numbers, strings, etc. for performance reasons
rather than wrapping those
those are not for performance reasons
but for usability reasons
you'd have to call #to_n on all of them otherwise
which would make it a pain in the ass even within the corelib
to stay on the safe side you should still call #to_n on those tho
because they call valueOf() on self or other things
Forrest Chang
@fkchang
Jul 08 2015 00:14 UTC
@meh so then, there is some sort of benefit to toll free bridging, but what would it be?
for things that aren't in the corelib? none
Forrest Chang
@fkchang
Jul 08 2015 00:16 UTC
that's a start. I'll note that opal-jquery does toll free bridging on element. @elia said he took advantage of the js object being extended, I'd be curious as to what circumstances
@meh does opal-browser do any toll free bridging?
nope
Forrest Chang
@fkchang
Jul 08 2015 00:17 UTC
so then general advice would be to favor include Native then
yep
Forrest Chang
@fkchang
Jul 08 2015 00:18 UTC
thx
@meh btw, working on anything cool lately?
working on a game in Rust
Forrest Chang
@fkchang
Jul 08 2015 00:18 UTC
ironically, my 13 yr old son just wrote a tic tac toe game in Rust
noice
send him towards glium and 3d stuff :^)
Forrest Chang
@fkchang
Jul 08 2015 00:20 UTC
yeah, he impresses me, taught himself java to write an adventure game, then ruby for another text based game, started SICP, but when stalled redirected to Rust. I explained to him virtualbox and he's been running different distro's to do his develpoment on
Torsten Rüger
@rubydesign
Jul 08 2015 01:33 UTC
@meh i was trying to follow the native discussion and looked at browser source. A lot of include Native there, but not much alias_native. I wonder is it even possible to use alias_naive when wrapping a larger api (for me pixi). I seems that "ruby" objects would make it back into the js framework and boom
Maybe just for simple attribute readers ?
Jikku Jose
@JikkuJose
Jul 08 2015 02:04 UTC
@jgaskins Thanks! I will look into it! Infact I prefer Haml better, I didn't expect to see it.