6 ms·
Try Ruby (in your browser, now with 1.9)
- aarongough 17y agoClever! But in all honesty, I was a little disappointed when I discovered that Ruby was not being emulated in JavaScript or something similar. Just bouncing the entered text back to a server-side instance of IRB instead...
- nym 17y agoTry-javascript-emulated-ruby?
- aarongough 17y agoYou forgot the '.org' :-D
- jmonegro 17y agoThe problem with using a javascript-emulated version is that it'd be way too limited, unless the dev went out of his way to cover much of the ruby language. This way, you can try the whole thing. JS emulated would be good if it was just a tutorial, but it's a bit more than that.
- mpk 17y agoWell, an official spec for Ruby is in the works and there's already one for JavaScript (ECMAScript). Someone is bound to build a Ruby VM in JS at some point and then it'll be trivial to build a site like this. The performance will be horrible, of course, but once that happens some other person will come along and run a subset of Rails (or some other Ruby web framework) with an evented db backend on it (for async callbacks to the server over HTTP) to run an app in the browser. Which would be pretty cool, though not useful. (But don't let that stop you, whoever you are!)
- ThinkWriteMute 17y agoI believe a Ruby VM is already in the works, but my cold addled brain can't google fu right now.
- Zev 17y agoThat would be HotRuby, http://hotruby.yukoba.jp http://hotruby.yukoba.jp.
- scotth 17y agoI can imagine a fairly clean mapping between languages. If the result of compilation was JavaScript code, to be passed on to the browser using eval(), the code would perform quite well. So, assuming that I'm correct, what you would be left with is the one-time cost of parsing. And how costly is parsing generally? (I am keeping in mind that Ruby may not be general)
- petercooper 17y agoIt would be possible to have a JRuby applet so everything would run within the browser but.. that'd involve having a multi megabyte applet to activate on the page and they kinda freak people out nowadays. Some sort of Flash based Ruby VM that you can interact with through JavaScript would make it rather interesting though..
- city41 17y agoType in "help", the tutorial that gets kicked off from that is pretty impressive. My Dad has been curious about programming and I think this is what I'm going to point him to.
- spicyj 17y agoI've got to admit that the 1.9 sticker and the "BETA" text don't really blend in with the existing look of the site.
- nym 17y agoYeah, too many fonts.
- ThinkWriteMute 17y agoInterface acts odd on Debian+Webkit+Chrome4.
- patio11 17y ago_why's version of this site was my first exposure to Ruby. I was a convert (from Java) as soon as I got to map. %w{apple pear banana}.map {|f| puts "#{f} is a fruit."} This experience shows one of the fundamental truths of software marketing, incidentally: anything you can do to reduce the barriers to trying the software out increases uptake dramatically. Eliminating the install is powerful, powerful stuff.
- harpastum 17y agoWouldn't it make more sense to use each rather than map for that example? %w{apple pear banana}.each {|f| puts "#{f} is a fruit."} => apple is a fruit => pear is a fruit => banana is a fruit Map is for creating a new array with each of the results in it, like this: %w{apple pear banana}.map {|f| "#{f} is a fruit."} =>["apple is a fruit.", "pear is a fruit.", "banana is a fruit."] which would return an array with each of the strings in it.
- jamesbritt 17y agoQuite right. puts %w{apple pear banana}.map {|f| "#{f} is a fruit."}.join(' And ')
- axod 17y agoIt was useful for me in an opposite way :) It showed me why I hate Ruby syntax. The above just looks horribly ugly. A mishmash of special characters. Not to mention special characters in strings (eugh). The probability of an undetectable typo in the code you paste is pretty high. Sure, it's not quite up there with regexp syntax, but it's getting close.
- oscardelben 17y agoIt's interesting because ruby is designed to be easy to read, and in my experience it's the programming language where I have less syntax errors compared to other languages like c, clojure, lisp, etc (which can be prevented 99% of times with an editor)
- deleted 17y ago[deleted]
- city41 17y agoNot being able to backspace (at least on my MacBook with 10.6) is a deal breaker here. As much as I'd like to be, I'm not a perfect typist.
- rudd 17y agoBackspace works here on my 10.6 Macbook in both Safari and Firefox. Though, Command-w to close it doesn't work for me.
- noisebleed 17y agoYeah, for whatever reason the command key doesn't register on the page
- city41 17y agoThe javascript key handlers are absorbing them. Outlook Web Access does this too (and it drives me crazy there).
- mshafrir 17y agoDoesn't work in Chromium for me.
- andrewfong 17y agoBackspace doesn't work with Chrome on Windows 7. Firefox is ok though.
- city41 17y agoIt appears to be a Chrome (and Opera) thing.
- WalkingDead 17y agoBackspace doesn't work on Opera too. Up arrow should bring forward the last line typed ---- that doesn't happen here.
- 17y ago
- jmtame 17y agoway too slow.. i'd rather just fire up irb
- stevejohnson 17y agoThat is not the point AT ALL. This isn't about knocking out one-off scripts to do useful things, it's about trying out the language to see if it's worth installing at all. _why the lucky stiff did a lot for Ruby evangelism. This site combined with the Poignant Guide turned a lot of curious folks into converts. I know this stuff despite being a Python fanatic. I have great respect for what _why did for the Ruby and programming communities in general.
- hbrundage 17y agoI read somewhere that the problem of "syntax design", that is choosing how a language requires you to write it, is regarded as "solved", that is we don't need any more constructs or abilities in languages. Whoever it was said that the real problems remaining are speed and size and the other stuff. I agree that this is the case, but only because Ruby exists. If you haven't tried it then really, please do, I think you'll like it.
- prodigal_erik 17y agoLanguage design isn't a solved problem until we have a language that enables the average programmer to add any syntax they need. Lisp only comes close by punting and rubbing everyone's nose in the raw parse tree, and the average programmer ritually shuns it anyway. Ruby doesn't even attempt to solve this problem. You can tell because if it didn't already have try/catch or begin/rescue or case/when, adding them yourself would be impossible.