<fkchang`>
meh`: I'll try to take a look later tonight
fkchang` has quit [Ping timeout: 272 seconds]
ylluminate has joined #opal
ylluminate has quit [Quit: Bye!]
std_io has joined #opal
<std_io>
hey, new here to opal. is it possible to require opal and then just type ruby into a file as though it was js and allow opal to handle the ruby code after that?
<std_io>
obviously it's essentially just setting up a ruby app
<std_io>
but i was thinking that there may be a way of just quickly jumping into opal dev like js
<std_io>
so i could just include opal and then write ruby in a .js file between perhaps some delimiter or tags that would dictate that this code needs to be treated as ruby
<std_io>
sure, and i see where you're going i think with that; but wouldn't it make sense to have a quick and dirty way to start writing ruby/opal apps by including the opal lib from cdn and then just write it in a browser and have it execute as js normally?
<dleedev>
std_io: like what coffee script does?
<std_io>
uhm, yeah, i guess that's a good way to say it dleedev
<std_io>
i just want to use ruby in the browser without "setting up first"
<std_io>
or i guess i know a number of people that would just like to "play" with it right off like coffeescript who prefer ruby
<std_io>
and just want to kind of fiddle and start getting their hands dirty withou the setup phase
<std_io>
s/withou/without
<meh`>
std_io, it's not that easy when you take requires into consideration
<std_io>
hmm, that is sad
<std_io>
i really had hoped for that. i was going to start introducing it to some students and this just makes it a little more involved
<std_io>
well thank you. hopefully this will change in the near future to make it easier to introduce it
std_io has quit [Quit: ¡Nos veremos!]
std_io has joined #opal
dleedev has quit [Quit: dleedev]
<meh`>
std_io, we were thinking about a way to generate standalone files for gems and stdlibs
<meh`>
but it's not that easy
<meh`>
and this will nerver change
<meh`>
if a gem requires stdlib files
<meh`>
you can't just compile the required stdlib every time
<meh`>
things are going to break
<std_io>
it seems important to attack this
<std_io>
it seems that a lot of people i know would give it a try right away if they could just pop it into an easy format and start hammering out ruby code in the a js file or even the web console
<ryanstout>
std_io: maybe someone should make a single script that you could include that includes the parser and lets you do <script type="opal"> .... </script> It wouldn't be something to use in production, but would make it easy to play with
<std_io>
yeah, who cares about production at early stages when people are just wanting to get their feet wet
<std_io>
this is just so novel and amazing an opportunity
<ryanstout>
yea
<std_io>
to have ruby on server, browser and to develop applications is just earth shaking for allowing students to really have a language that they can sink their teeth into at any level of interest
<std_io>
and got: Failed to load resource: The network connection was lost.
<std_io>
any idea if this is a known issue?
<std_io>
this was simply on the first application.rb
dleedev has joined #opal
marcandre has quit [Remote host closed the connection]
<std_io>
so i was trying to quickly go through a little exercise that a student sent me who brought opal to me, he wanted to try converting a tiny little exercise he wrote in js to ruby/opal: http://jsfiddle.net/A2d9g/
<std_io>
obviously this is super trivial in js, but i'm kind of hitting some walls on opal
<std_io>
anyone able to give an example of how to convert this over in a clean and simple script?
<meh`>
std_io, I have the feeling you're in an unlucky timezone
<meh`>
all the core devs are in Europe
<meh`>
std_io, anyway, you could either use opal-browser, opal-jquery or write a small source with helpers to provide to your students
<meh`>
but I really have to sleep now
<std_io>
thanks meh`. it is unfortunate. i was hoping to show a quick clean solution to get them started
<std_io>
they got really excited when we started talking about opal and i thought this would light their fire
<std_io>
i guess pacific isn't compatible with opal right now :-(
<std_io>
so last night i had some bad luck apparently being on pacific timezone and i thought i'd try to pop on this morning to post to perhaps people who may be normally on in europe.
<adambeynon>
ryanstout: sounds like you are running it from git?
<ryanstout>
yea, should I go back to the gem version?
<adambeynon>
Yes. That missing file gets built when I release the gem
<adambeynon>
The latest gem should support all opal versions
<std_io>
so adambeynon with the prebuilt that you have there can we write simple examples such as including opal and then on the same js script below write ruby and have it executed? similar to coffeescript so that there is not this setup phase for trivial examples?
<ryanstout>
adambeynon: thanks, I'll give that a try
<adambeynon>
std_io: yes. In your HTML file add a <script type="text/ruby"> and the parser will compile and run it
<std_io>
and any more info i can provide adambeynon for this bug? i sincerely don't know what else i can tell you except that i was following your getting started tutorial and it blew up when i first hit the browser, so you have everything you need to rinse and repeat
<ryanstout>
adambeynon: looks like opal-rspec is fixed to ~> 0.5.0 I need some stuff thats in 0.6
<adambeynon>
ryanstout: try 0.3.0.beta2
<ryanstout>
ok, thanks
<adambeynon>
ryanstout: something I should have added docs on :P
<std_io>
oh that is excellent, meh` did you see that about <script type="text/ruby"> and our discussion last night?
<meh`>
std_io, nope
<ryanstout>
adambeynon: sorry to keep bugging you. any idea why defining classes in a before do ... end block wouldn't work with opal-rspec (works in mri)
<ryanstout>
sorry another question. does anyone know why bundle exec opal-repl wouldn't work even though I'm on 0.6.0 via git? bundler: command not found: opal-repl If I do bundle open, I see it in there
<meh`>
ryanstout, it's not part of the release
<ryanstout>
meh`: because its not in the gem spec .executables?
<meh`>
ryanstout, yep
<ryanstout>
I can add a PR for that if you guys want
<meh`>
I don't remember why adambeynon didn't add it
<meh`>
I remember he had a reason
<meh`>
but not the reason
<ryanstout>
maybe because it depends on therubyracer?
marcandre has joined #opal
<meh`>
yeah, that
<adambeynon>
Yeah. The ruby racer as a dep is a pain. I'm thinking about making opal-node the basis for the REPL instead
<meh`>
sounds good
<meh`>
the only thing I use node.js for is a javascript REPL
<adambeynon>
Yep. Has some benefits as well as being mega speed.
<meh`>
std_io, sadly no, I was pushing adambeynon to write something like opal-gem to compile a gem to a single file
<meh`>
std_io, this is where it gets complex with requires tho
<meh`>
opal-browser uses a bunch of stdlibs
<meh`>
and they'd have to be included separately and ignored
<meh`>
std_io, also opal-browser is cherry-picked
<meh`>
so you have to require what you want
<meh`>
std_io, but sincerely, I think the best way to go would be to provide some kind of playground
<meh`>
just a directory
<meh`>
with a Gemfile and a config.ru
<meh`>
tell the students to put their stuff main.rb
<meh`>
and it's done
<std_io>
well, right now this "in browser" approach is useful for the "shock" effect. it's like how a good joke doesn't require "setup" to get a good laugh out of everyone ;-)
<meh`>
std_io, I understand that, but it's not really how opal was designed require-wise
<std_io>
yeah, just important to get people to raise their heads and take interest sometimes
<std_io>
when you teach people there is a lot of hand waving and illusions. i feel like a magician most of the time! :-D
<std_io>
if you don't, people don't wake up and get excited properly
<ryanstout>
std_io: where do you teach?
<std_io>
a high school
<ryanstout>
thats pretty great that they teach CS. I'm from montana and its everything we can do to get schools to teach CS. (we've been doing this project and had some success - http://www.codemontana.org/)
<std_io>
that is cool. i am more trying to teach some bright technology class students web/javascript stuff to get them a headstart, but utah is having some success with a new online comp sci high school. really innovative stuff.
<ryanstout>
cool
<std_io>
i think one of them found fkchang's presentation and got excited about ruby :-)
std_io has quit [Quit: ¡Nos veremos!]
std_io has joined #opal
std_io has left #opal [#opal]
skofo has joined #opal
skofo has quit [Ping timeout: 248 seconds]
ylluminate has joined #opal
marcandre has quit [Remote host closed the connection]
std_io_ has joined #opal
<std_io_>
adambeynon: do comments work in opal?
<std_io_>
I tried "puts "Hello world!"# Output to js console" and it won't run in the console anymore
<ylluminate>
oh that is cool. you're running rb from the html
<ylluminate>
neat
<std_io_>
yes, adambeynon told us how to do that earlier today
<fkchang>
std_io_: I have a few things that might help u, 1 is a translation of your rock scissors paper thing, another is this project to make it easy to create various opal projects (which I need to pep up before releasing), but is designed to get u running from 0 to project in 2 steps
<std_io_>
Oh that is wonderful fkchang! THANKS!!
<ylluminate>
weird, i just gave that a try std_io_ and by removing the tab (just a space in the comment) it worked for me
<ylluminate>
adambeynon: might be a bug in the parser that is not catching tabs properly?
<meh`>
my bet it's a bug in the compiled parser
<fkchang>
meh`: how do u check for null i.e. val = `something_that_returns_null` -- it might be this is different than 0.5.* where I am
<meh`>
fkchang, you have to do it with inline js
<meh`>
I usuall do
<meh`>
if val = `possiblynull() || nil`
<fkchang>
meh`: thx, I'll give it a go
<meh`>
as long as you're not expecting "", 0 or false
<ylluminate>
when i removed those std_io_ meh` it worked for me... :\
<meh`>
oh right
<meh`>
0.5 has native included by default
<meh`>
yeah, guess it's tabs fucking it up
<std_io_>
wtf
<std_io_>
ok. crazy thanks
<meh`>
lol
<meh`>
yeah, I confirm the bug
<meh`>
puts "hello"<TAB>
<meh`>
compiles to puts
<ylluminate>
lol
<ylluminate>
is that on the current master as well and not just this older .5.3 that he was including?
<meh`>
current master
<ylluminate>
jeepers, good you found that out
<meh`>
I guess I will lose my official bugomancer title
<ylluminate>
i love your avatar meh`
<meh`>
:)
<ylluminate>
i see something new every time i look at it
<ylluminate>
i saw a little man with a mustache at the top of the tie and then looked back again and saw a storm trooper
<meh`>
lol
<ylluminate>
rofl
<ylluminate>
that chat about a cdn and what to include earlier is pretty important. perhaps we should work on a more robust flat include system so we can just check components we want like mootools builder http://mootools.net/more/
<meh`>
ylluminate, I think it's feasable with the current system
<meh`>
if adambeynon doesn't work on it, I will soon enough
<meh`>
it fits well with paggio
<meh`>
snap
<meh`>
and I thought I had found the issue :(
marcandre has joined #opal
<ylluminate>
great to hear. opal's going to explode here soon and if these little pieces of the puzzle are in place, it's really going to help
<meh`>
0.6 should bring in enough attention
<meh`>
it has a lot of stuff
<ylluminate>
funny thing is that as nice as the features are, this boiler plate / bezel stuff like a cdn and simple "hello world" style things like std_io_ was playing with are probably the most important parts
<meh`>
agree
<meh`>
we also need a good CLI REPL
<ylluminate>
i guess it goes back to the CRUD demo that rails threw up at the beginning
<ylluminate>
absolutely
<meh`>
sadly I'm not good at user experience stuff
<meh`>
all I can bring is feature awesomeness
<ylluminate>
people just want to jump in and do js work as they normally do, but with ruby instead so i was really happy to see that discussion
<ylluminate>
lol
<meh`>
like lazy enumerators
<meh`>
or well, I wrote most of the Enumerable stuff
<ylluminate>
interesting
<fkchang>
ylluminate: I think my opal starter kit will help a lot in bootstrapping, I just have to get around to finishing it. Right now it only supports a static html, compiled js project, opal-server will be easy to support, built in rspec, etc...
<meh`>
and if only I could fix this fucking bug we'd have promises too
<fkchang>
I'll try to make a push to get it out w/say 2 types of projects during the holidays
<ylluminate>
that's great fkchang
<fkchang>
the goal is, gem install opal-starter-kit; osk new static my_project - and u'r ready to go
<meh`>
in this context promises are the retarded kind you can do in JavaScript
<fkchang>
meh`: while we're at it, what's ur base model of promises, it's different than say the A+ spec, which isn't a bad thing, just trying to get inside ur head
<meh`>
fkchang, I'm following the features in the A+ spec
<meh`>
but it has a Rubyesque API
<meh`>
and the model is the code I want to see in my production code
<fkchang>
correct me if wrong, A+ spec pretty much just says you need a then
<meh`>
yes
<meh`>
but there are also other discussions about compatibility between different promise implementations
<meh`>
which I completely disregarded
<meh`>
my implementation has more utility
<meh`>
*utilities
<fkchang>
so when I look at the specs in the PR, I see a lot more things, i.e. the errors, etc. I think error_spec might be clearer if we put in a real error instead of 23
<meh`>
well, errors can be anything
<meh`>
rejection behaves differently from resolution
<meh`>
regardless of the error value
<meh`>
resolution goes down the whole chain
<meh`>
rejection only goes down up to the first error handler
<meh`>
given it doesn't return another promise
<fkchang>
I did a glance through, but want to be go through it in more depth. It'd be easier if I I ran it, I guess
<meh`>
yeah, but be warned it will fuck with your mind
<meh`>
using it is easy, writing it, not that much
<meh`>
doing this fucked my mind more than Enumerator::Generator and Enumerator::Lazy
<std_io_>
fkchang: what if i wanted to take what you did on the rock-paper-scissors example on opal-irb and transfer it into a single page html like the hello world page i threw up earlier? something like http://pastebin.com/raw.php?i=PFfXHmr0
<meh`>
what the fuck
<meh`>
#<< is never getting called for Promise::When
<meh`>
what the hell is going on
<fkchang>
std_io_: I think that should work, I prefer to to do separate files
<fkchang>
std_io_: u could try this directory as a startup. It's meant to show how to test js via opal-rspec, but put opal code in the /app dir, and it will automatically get compiled to the js file and you can open index.html. I.e. change code, run "rake view" and u can write specs too