<meh`>
adambeynon, do if's ever get wrapped in functions?
freck has joined #opal
<freck>
hello everyone, I'm pretty new to using opal and jquery (i dont know javascript or jquery very well) and I'm trying to figure out how to use the .html() function jquery implements. When I write element.html('string') in ruby it compiles to $html('string') in javascript which does not work because of the dollar sign, it does work without the dollar sign. What do i need to write in ruby in order to compile to javascript without the
<meh`>
freck, are you using opal-jquery?
<meh`>
Opal compiles Ruby to its own thing, it's not a seamless bridge between Ruby and JavaScript
<meh`>
you can either wrap the objects in a native Native(`js stuff`)
<meh`>
or use opal-jquery that does the bridging itself
<freck>
ok, yeah i am using opal-jquery though, sorry i forgot to mention that
<meh`>
how are you accessing the element?
<freck>
so while using opal-jquery how do i access the .html() function? other functions like find are working without an issue
<meh`>
freck, I use opal-browser instead of opal-jquery, so I don't know much about it
<freck>
ok, it seems to be that by default Element.find('div.demo-container').html('something') compiles to …..$find("div.demo-container").$html("something"); when really i need …..$find("div.demo-container").html("something"); basically no dollar sign
<meh`>
adambeynon, do we have char in the list of reserved words?
<meh`>
a guy I know said the closure compiler was whining about it
<meh`>
but it probably comes from its usage in string.rb
<meh`>
I'll fix it later
<adambeynon>
no, doesnt look like we do
<meh`>
yeah, add it, it's reserved
<meh`>
I was reading eloquent javascript for shits and giggles earlier and it mentioned it
<meh`>
adambeynon, there were many more warnings with the closure compiler by the way
<meh`>
adambeynon, you might want to run it on the corelib to see where the compiler can be improved
<meh`>
most warnings were about never reached code
<meh`>
possibly the `return nil` we always add at the end
<adambeynon>
meh`: is there anything else you wanted in opal 0.4.5 before I publish a release?
<meh`>
adambeynon, the super fixes? :)
<meh`>
and I'm still cleaning
<meh`>
most is done
<meh`>
but the cleaning can wait, I use master anyway
<meh`>
but I'd really like the 3 super bugs I reported to be fixed
<adambeynon>
meh`: not sure if im going to be able to get around to those anytime soon
<meh`>
:(
<adambeynon>
they probably require a big super() rewrite
<meh`>
I see
<meh`>
what about the escape disabling on %x and ``?
<meh`>
too early?
<meh`>
adambeynon, you can bump whenever by me
<meh`>
I think it's better to keep those changes for the next
<meh`>
runtime cleanup, super fixes, and completed corelib cleanup
<meh`>
adambeynon, oh, but wait
<meh`>
let me commit the leftover time.rb cleanups
<adambeynon>
meh`: before I release, I do need to find a way to dynamically pick the runtime - I have a fork of runtime.js that Im now using in all my apps
<adambeynon>
classes as functions
<meh`>
I see
<adambeynon>
although, there would need to be changes to class.rb and module.rb as well
<adambeynon>
so its all kinda tricky
<meh`>
what's the advantage of classes as functions?
<adambeynon>
cleaner runtime, basically
<adambeynon>
.prototype
<adambeynon>
instead of lots of ._proto bits n bobs
<meh`>
I see
<meh`>
what are the downsides?
<adambeynon>
no method_missing on classes/modules
<meh`>
ah
<meh`>
but that's important :(
<adambeynon>
I appreciate that, which is why there should be a way to choose which you would prefer
<adambeynon>
but for me, I dont need method_missing at a class level
<adambeynon>
and dont really use method_missing in production either
[spoiler] has joined #opal
<meh`>
I repropose having an opal/lean
<meh`>
for that kind of need
<meh`>
instead of making maintaining opal even harder
<adambeynon>
meh`: yeah, but at the same time, I dont really have an interest in maintaining code I dont want/use/support there
fkchang has joined #opal
elia has quit [Quit: Computer has gone to sleep.]
elia has joined #opal
<meh`>
adambeynon, the thing is, I think compliancy should be the most pressing concern for Opal, and we shouldn't add complexity to the main repo for the sake of either one of us
<meh`>
adambeynon, but if it's just a flag that gives it a different path for the runtime, I have nothing against it
<meh`>
I just don't want to start seeing different versions of everything to accomodate the needs of one
<adambeynon>
meh`: but my aims for opal wern't to aim for 100% compliancy, they are to make a ruby-ish runtime in javascript. and loosing method_missing support at a class level is an acceptable trade off for me
<meh`>
adambeynon, doing that you lose a lot of DSL capabilities
<meh`>
and if your reason is "I don't use method_missing anyway" it doesn't sound like a good argument to me
<meh`>
what I'm saying is, what's the huge upside that makes it worth not having method missing on classes and modules?
<meh`>
Opal should be as close to Ruby as possible, if it's not Ruby and we don't have real limitations to implement such features, we need a good explanation for it
<meh`>
as in, why would people want to use Opal?
<meh`>
in my opinion the biggest selling point of Opal is "this is Ruby, on the browser"
DrShoggoth has joined #opal
eventualbuddha has joined #opal
<e_dub>
The thing about opal that most impressed me was how compliant it was. My question is, is it really important that the javascript be clean? Opal code is never gonna compile to javascript as clean as as something like the javascript coffeescript produces, the semantics are just too different. Personally, I think focusing on making debugging it via source maps and being able to use javascript debugging tools really really good, and NOT have to
<e_dub>
ever , or almost never , look at the javascript. Treat that stuff like assembly, it's super low level and if you are messing around in it, you know what you are doing anyways.
<e_dub>
just my opinion. I don't have any problem with being able to turn various features on and off though, whatever someone's reasons are
<meh`>
e_dub, I think code tidyness is very important in debug mode, no matter how advanced our debugging tools can be, you'll always end up reading the javascript code
<meh`>
e_dub, but that can be easily achieved with helpers like $yield, $if, and others
<meh`>
but as I said, I think compliancy should be the major priority for Opal
<meh`>
if it's not Ruby, there's no point in using it
<fkchang>
I came into this in the middle, so I don't know what technical issue is being discussed exactly, but I would have to say the appeal of Opal is that it's ruby in the browser.
<meh`>
fkchang, the gist of what I understood adam wants to do, is removing method missing support from classes/modules
<meh`>
but I use it in lissio
<meh`>
but he didn't make what his plans are very clear
<fkchang>
meh`: probably coz something is ugly or hard, I'm sure. If knew that sort of stuff, I'd be happy to help
<meh`>
fkchang, ugly most likely, but if it makes method_missing work on class and module it's a worth downside
elia has quit [Ping timeout: 245 seconds]
<meh`>
adn I think with that change it would be impossible to do the Array inheritance trick
<fkchang>
not that it should influence adam, but I have a bullet in my preso that there is an opal goal of 100% rubyspec compliance, coz I thought that was the idea. I'll just need to change that
<meh`>
I thought that was the idea too
<meh`>
fkchang, wait for adam first
<meh`>
maybe we'll convince him :D
<fkchang>
I suppose implementing would convince him
<meh`>
fkchang, but anyway, 100% rubyspec is impossible to achieve
<meh`>
some things just cannot be implemented in js
<meh`>
but I think a good 90% can be achieved
<meh`>
in the past week I've done A LOT of work toward compliancy
<meh`>
in the corelib mostly
<brixen>
meh`: we already have the with_feature :stuff guard
<fkchang>
I think "striving for 100%" is a good thing to publicize, if it's true
<brixen>
meh`: so please let me know what things can't be supported so we can properly wrap them in features
<brixen>
fkchang: even MRI isn't "100%" because eg no fork() on Windows
<meh`>
brixen, wait a sec, I'll link the filters to you
<brixen>
it's more a matter of compliance with a set of features
<adambeynon>
I think we alias the scope betwene Object and BasicObject
<adambeynon>
can be fixed though
<adambeynon>
fkchang: how is the rubyconf presentation going? I havent had time to look at the methods/json stuff yet, sorry
<meh`>
fkchang, a remainder of things you should publicize, Enumerable is almost fully implement and all relevant specs pass, only few methods are missing and I'll finish those by next week probably
<meh`>
fkchang, also Opal supports coercion now
<meh`>
fkchang, and my demo app is almost done
<adambeynon>
and we can run rspec with only 10 1-liner modifications
<adambeynon>
should be 3 by next week
<adambeynon>
once heredocs stop ruining my evenings
<meh`>
lol
GitHub52 has joined #opal
GitHub52 has left #opal [#opal]
<GitHub52>
opal/master ef6ec53 Adam Beynon: Add 'char' as a reserved javascript keyword
<GitHub52>
[opal] adambeynon pushed 1 new commit to master: http://git.io/fFVAyQ
<meh`>
adambeynon, did anything change in the runtime?
<meh`>
oh oh
elia has quit [Quit: Computer has gone to sleep.]
<meh`>
adambeynon, it didn't, but with BasicObject the proto magic doesn't work
<meh`>
any clue?
elia has joined #opal
<adambeynon>
thats...really odd
<adambeynon>
erm
<adambeynon>
ahh
<adambeynon>
well
<adambeynon>
actually, no it shouldnt matter
<meh`>
wait
<meh`>
I know
<fkchang>
adambeynon: rubyconf preso pretty decent. I did a dry run for ocruby with probably 80+% of the content I intend on having. I could use a proofread/any things you guys want to publicize.
<meh`>
adambeynon, does BasicObject have a different allocate?
<meh`>
because I'm using it
<adambeynon>
meh`: nope, same allocate for all classes
<fkchang>
adambeynon: oh, and corrections/additions to any facts too
<meh`>
adambeynon, is there a reason for #is_a? to reimplement Module#=== ?
<meh`>
*Kernel#is_a?
<adambeynon>
meh`: it is possible for a class to override #=== I suppose
<meh`>
right
<meh`>
best way to use Kernel#is_a? in a BasicObject?
<meh`>
without killing myself
<meh`>
adambeynon, I think it's a bad idea to use BasicObject
<meh`>
or not
<meh`>
but it's creating more problems than not
<meh`>
◕ ◡ ◔
<adambeynon>
well, we dotn have to use BasicObject, but, we need to make sure that we reimplement every important method that array overrides
<adambeynon>
==, eql
<adambeynon>
etc
<adambeynon>
<=>
<meh`>
yeah, that's true
<adambeynon>
dup, clone
<meh`>
I think with #is_a? all is done
<meh`>
thoughts on how to tackle it?
<meh`>
using `klass === self` doesn't work
<meh`>
something tells me we should have an Opal.is_a?
<meh`>
and use it in both, and here too
<adambeynon>
it uses a while loop which would be quite awkward to inline
<adambeynon>
as it is only 1 case though
<meh`>
adambeynon, I'm not thinking about inlining here
<meh`>
adambeynon, it's in 3 places
<meh`>
Kernel, Module, and Array::Wrapper
<meh`>
and it will be in String::Wrapper too
<meh`>
but it won't work
<meh`>
maybe an helper in the runtime rather than an inlined
<fkchang>
meh`: opal inspector are talking to slides, of how it's basically insipred by smalltalk's class/object browser. Rpal objects, is an artifact of the starwars font I'm using, Capital O looks like an R type character
<meh`>
fkchang, oooh
<meh`>
fkchang, makes sense
<meh`>
adambeynon, is Opal.to_ary used anywhere?
<meh`>
I can't find it
<adambeynon>
meh`: compiled code uses it
<meh`>
oh
<adambeynon>
for masgn
<meh`>
oooh
<fkchang>
adambeynon: Yeah, so any additional facts/selling points are appreciated, or corrections, if my interpretation is wrong. I have you as having 3 apps in production, but all private
<adambeynon>
a, b, c = d
<meh`>
ok
<adambeynon>
tod = to_ary(d)
<fkchang>
meh`: 's app is the "coming soon" video, as far as I can tell
<fkchang>
adambeynon: also percentage of rubyspecs passing could be a good metric
<adambeynon>
fkchang: sure.. by then we should have lots more rubyspecs
<adambeynon>
and opal-rspec will be finished/released
<fkchang>
adambeynon: if you ever get around to being able to provide a basic lookup code for method for precomipled and live, I would add that feature and demonstrate, finding a method, changing the code in the browser, demonstrating the changed code, etc. to give a better feel of development in the browser
<adambeynon>
seems a good target date for our new release @meh`
<meh`>
adambeynon, yeah
<adambeynon>
fkchang: how complete is opal-irb
<meh`>
we'll have inheritable Array and String by then
<meh`>
lol
<meh`>
fucking aliases
<meh`>
I just did this all for nothing
<meh`>
kind_of? was still referring to the Array is_a
<meh`>
but I still think the opal runtime helper for is_a DRYs it up
<fkchang>
Also the whole section "doing things the ruby way", I wanted to have a bunch of JS : cubmersome way, Ruby and Opal, really awesome way. I only did it w/the modules, but I wanted to have a bunch of those using the the vader, yoda, luke backgrounds. In general I want to strengthen the JS == evil empire, Opal == jedi/rebel alliance
<adambeynon>
meh`: in fairness, I think a lot of Module belongs in the runtime
<adambeynon>
fkchang: a comparison of our todomvc vs. backbone might be nice
<adambeynon>
to show off the different coding styles
<adambeynon>
we could even push it more towards emphasizing ruby nice-ness
<adambeynon>
and erb templates..
<adambeynon>
backbone todomvc uses a lot of underscore, so a comparison perhaps of underscore vs. Enumerable
<fkchang>
adambeynon: opal-irb is has most of the features I want in the near future, I wanted to get the live code editing on opal-inspector going before I went back and added more to opal-irb. I'll note, some weird behavior for codemirror wrt 'd' and 'e' going to the beginning of line has been introduced since I upgraded opal-irb to point to head instead of 0.4.4
<meh`>
adambeynon, agree
<fkchang>
adambeynon: I'd do a backbone vs vienna comparison, except I still don't know how to use vienna
<adambeynon>
or meh` is doing a lissio demo app
<adambeynon>
that would do
<meh`>
I am, but it's not a todo app because that sounded boring
<fkchang>
meh`: has given a few sprunge gists that look really good for lissio. I was thinking of putting sample lissio code for future (coz I like the define a component in 1 place thing he's doing), and that gist where you wrote the opal code on the ruby side, which is sort of meteor like
<fkchang>
I'd like to get enough savvy to do lissio or vienna stuff live, though I do need to cap it at 40 min, so maybe I'll do only canned coding
<meh`>
adambeynon, also, I think we should name all the runtime methods with $
<fkchang>
The current presentation is about 40 w/o a bunch of additions, so I'll be trimming stuff, I think I'll drastically cut short the code review of opal-inspector
<meh`>
adambeynon, we can't use certain names anyway
<fkchang>
meh`: u should watch the video when u get a chance, might clear up some stuff.
<adambeynon>
fkchang, meh` : I've got to go, be back later
<meh`>
fkchang, where can I find it?
<adambeynon>
will have a think about the json/methods for opal-inspector..
<fkchang>
if any of you guys has a good code example that u'd want me to show, I'd gladly take it. I'm loathe to research the js way of doing a bunch of stuff
<fkchang>
meh`: I realize the email that had the link bounced coz of the attachment, I'll send it
<meh`>
fkchang, thanks
<meh`>
fkchang, also I think anything that has to do with Enumerable and Enumerator would be nice
<fkchang>
meh`: u got mail..
<meh`>
except I now realize the fibonacci example wouldn't work
<meh`>
we don't play well with infinite enumerators
<fkchang>
meh`: is inner_dom new?
<meh`>
fkchang, yes, quite recent
<meh`>
needed it in lissio and it seemed like a good idea
<meh`>
there's inner_text, inner_html and inner_dom
eventualbuddha has quit [Ping timeout: 248 seconds]
<fkchang>
makes sense, not in my most recently compiled version of opal-irb, though inner_text and inner_html are
<fkchang>
yah, my codemirror went away w/a bundle update
<fkchang>
though unnerving too
urizen has joined #opal
<urizen>
quick question about the opal project
<meh`>
ask away
<urizen>
how mature is the project? is it considered too early for use in production projects?
<meh`>
urizen, it's used in production in some important places
<urizen>
ok cool
<urizen>
it currently doesnt support all of ruby, right? things like eval?
<meh`>
eval is supported
<meh`>
but you have to include opal-parser.js in the page
<urizen>
i see
<meh`>
which happens to be bigger than opal itself when compiled
<meh`>
so I'd suggest not using it in production
<urizen>
ok thanks
<urizen>
how much of the ruby language is supported with opal-parser included?
<urizen>
all of it?
<meh`>
opal-parser only adds eval support
<meh`>
the only things we can't support are taint, freeze, mutable strings and encodings
<fkchang>
bummer, the code mirror weirdness is back w/that combo though, I'll track that later
<meh`>
fkchang, anyway, I think showing the tooltip and alert code from the lissio standard components might give a good idea of how lissio components are made
<meh`>
but I can add inner_dom= so you can set a value as sole DOM node
<meh`>
so you'd do $document["mydiv"].inner_dom = shopping_list(...)
<meh`>
fkchang, does that sound ok?
<meh`>
you can't easily compose builders
<fkchang>
meh`: that sounds fine. I was mostly just trying to explore how I might use inner_dom to compose complicated things, and extracting methods for common things just made sense
<fkchang>
In general, I'd like to abstract away from dom at the application level and just state my intentions like VBox { title; questionaire }, which is sort of along the lines of shopping list
meh` has quit [Ping timeout: 246 seconds]
meh` has joined #opal
<fkchang>
meh`: is event handling built into opal-browser, or lissio ala d.a.href("/person/#{payment.recipient.name}").do(payment.recipient.name).
<fkchang>
meh`: so I think something like this would work http://fkchang.github.io/opal-irb/index-embeddable.html#code:DOM%20%7B%20%0A%20%20h1(%22yo%22).on%20%3Aclick%20do%20%7Ce%7C%0A%20%20%20%20alert%20%22hi%22%20%0A%20%20end%20%0A%7D.append_to%20%24document%5B%22mydiv%22%5D
<fkchang>
hope that's under 500 chars
<meh`>
fkchang, yes
<meh`>
fkchang, but I think you need a more recent version of opal-browser
<meh`>
I don't remember when I added that
<meh`>
it was around the time I added <A> support
<meh`>
later for sure
<meh`>
828dad69 it was added on this commit
<meh`>
if it's not working, it's probably that bug with blocks we're still trying to pinpoint
<meh`>
I had an issue where it wasn't working
<meh`>
I had to use the syntax you saw in the example for it to work
adambeynon has joined #opal
fkchang has quit [Ping timeout: 265 seconds]
GitHub21 has joined #opal
<GitHub21>
opal/array-inheritance c60c34e meh: Cleanup and compliancy fixes for Array#<=>
GitHub21 has left #opal [#opal]
<GitHub21>
opal/array-inheritance 5dbc5b2 meh: Fix Array.new behaviour with subclasses
<GitHub21>
[opal] meh force-pushed array-inheritance from 6bbce45 to af2ae97: http://git.io/5RUpjg
<GitHub21>
opal/array-inheritance c81546f meh: Fix typo in Array#*
GitHub129 has joined #opal
<GitHub129>
opal/master 5fec442 meh: Fix typo in Array#*
<GitHub129>
opal/master 23393da meh: Cleanup and compliancy fixes for Array#<=>
GitHub129 has left #opal [#opal]
<GitHub129>
opal/master a217855 meh: Fix Array.new behaviour with subclasses