Can we use direct ruby instaed of javascript?

Hi Ninjas,

i am a ROR Developer .
I feel happy to develop in ROR over other frameworks because of the
simplicity of Ruby Language

For browser side code i am using Javascript/ActionScript .
but i would like to use Ruby in browser side also (instead of
Javascript/ActionScript)
Is there any way to do this ?
or
Is there any active development /future plan to implement Ruby VM on
browser engine (instead of javascript/actionscript engines ) ?
if yes? then i also want to join in that community/dev team .
if not? please some body initiate a plan to develop a Ruby VM for
browser engine (so i can join with you)
i know already that prototype/jquery frameworks are there but those are
not
looking like pure ruby code

Anyone have an Idea/Suggestion/Intrest ?
please let me know

by

Mokkai @ TLI

Hi,

I am sure there are quite a few projects out there to do what you wish
to.
Quite sometime back I came across this -
http://ejohn.org/blog/ruby-vm-in-javascript/

http://ejohn.org/blog/ruby-vm-in-javascript/That should help you out,
I
haven’t used it or worked on it extensively, but it is close to what you
wish to do.

On Thu, Apr 7, 2011 at 12:14, Sniper A.
[email protected]wrote:

or
please let me know

by

Mokkai @ TLI


Posted via http://www.ruby-forum.com/.


Thanks & Regards,
Dhruva S. http://dhruvasagar.net

thx , but i thing HotRuby is dead. There are no updates from last 3
years

If you have been to any large corporate’s offices of late, you would
notice that pcs are so locked down it’s surprising you’re still allowed
to touch the keyboard.

If you tried to require such users to load Ruby, you would immediately
lose a huge target audience. Would all those employees wait until they
got home to user your site, or log on to a more friendly competitor?

If you want to code in Ruby, I suggest you need to think about a
pe-processor that turns Ruby into JavaScript prior to sending the page.

Hmmm, I only know of that.

On Thu, Apr 7, 2011 at 13:03, Sniper A.
[email protected]wrote:

thx , but i thing HotRuby is dead. There are no updates from last 3
years


Posted via http://www.ruby-forum.com/.


Thanks & Regards,
Dhruva S. http://dhruvasagar.net

On 7 April 2011 08:52, Dhruva S. [email protected] wrote:

Hi,

I am sure there are quite a few projects out there to do what you wish to.
Quite sometime back I came across this -
John Resig - JavaScript Programming

http://ejohn.org/blog/ruby-vm-in-javascript/That should help you out, I
haven’t used it or worked on it extensively, but it is close to what you
wish to do.

Another option to use might be JRuby.

Java plugin is quite standard in browsers these days.

HTH

Michal

On Thu, 7 Apr 2011 15:44:50 +0900, Sniper A. wrote:

Hi Ninjas,

i am a ROR Developer .
I feel happy to develop in ROR over other frameworks because of the
simplicity of Ruby Language

For browser side code i am using Javascript/ActionScript .
but i would like to use Ruby in browser side also (instead of
Javascript/ActionScript)
Is there any way to do this ?

I have a project called ColdRuby which is essentially a Ruby 1.9
bytecode
to JavaScript translator. It cannot (yet) even load mspec/RubySpec, but
is
already somewhat usable.

GitHub - whitequark/coldruby: ColdRuby is a compiler of Ruby 1.9 MRI bytecode, and a runtime written in JavaScript to aid in execution of Ruby code. It also includes a C++ executable using very fast V8 scripting engine and native extensions for regular expressions, fibers and more.

On Thu, Apr 07, 2011 at 09:50:14PM +0900, Peter Z. wrote:

bytecode to JavaScript translator. It cannot (yet) even load
mspec/RubySpec, but is already somewhat usable.

GitHub - whitequark/coldruby: ColdRuby is a compiler of Ruby 1.9 MRI bytecode, and a runtime written in JavaScript to aid in execution of Ruby code. It also includes a C++ executable using very fast V8 scripting engine and native extensions for regular expressions, fibers and more.

I don’t see any license listed. Did I overlook it?

On Fri, Apr 08, 2011 at 05:37:49AM +0900, Peter Z. wrote:

On Fri, 8 Apr 2011 01:48:58 +0900, Chad P. wrote:

I don’t see any license listed. Did I overlook it?

The Ruby license, of course. It is implicit.
(Indeed, I just forgot to add it to git. Fixed already.)

I haven’t looked closely enough to know which way this goes, but one of
two sets of conditions are likely to apply here:

  1. It’s “implicit” because it incorporates Ruby Licensed code in a way
    that requires the Ruby License to be applied to the whole project. In
    this case, you violate the terms of the license if you do not include
    the
    license text with the code.

  2. It’s not “implicit”, and needs license notification.

I’m not a lawyer, but I spend a lot of time trying to avoid giving
lawyers reason to contact me with bad news.

On Fri, 8 Apr 2011 01:48:58 +0900, Chad P. wrote:

I have a project called ColdRuby which is essentially a Ruby 1.9
bytecode to JavaScript translator. It cannot (yet) even load
mspec/RubySpec, but is already somewhat usable.

GitHub - whitequark/coldruby: ColdRuby is a compiler of Ruby 1.9 MRI bytecode, and a runtime written in JavaScript to aid in execution of Ruby code. It also includes a C++ executable using very fast V8 scripting engine and native extensions for regular expressions, fibers and more.

I don’t see any license listed. Did I overlook it?

The Ruby license, of course. It is implicit.
(Indeed, I just forgot to add it to git. Fixed already.)

I think it might be actually quite interesting for the original poster
to take some of FONC’s work such as OMeta, and then the Rubinius
project… and use it to build Ruby in OMeta, which could then be used
quite easily to plug this Ruby implementation in OMeta into the
JavaScript implementation OMeta which is already existing…

For an example of SmallTalk already written in OMeta/JS (ie SmallTalk
running inside Javascript, through OMeta), please see:

http://tinlizzie.org/ometa/ometa-js-old/

Given that JavaScript is pretty much the only fully realised
cross-browser cross-platform implemented programming language that we
have available to us (ie guaranteed to be on EVERY machine for the last
10 years), and also given that so much work is continually put into
making these interpreters fast and small, I think writing things on top
of JavaScript is a brilliant idea.

The other interesting thing about targeting OMeta as an implementation
language for a VM in Ruby, while incredibly technically challenging, is
that it would be infinitely rewarding, as there are versions of OMeta
written in most common programming languages already (which means the
target language base of the Ruby implementation in OMeta would grow
without any additional effort on the part of the programmers)… people
are writing OMeta implementations in various languages, and there are
already ones written in:

OMeta itself, C#, SmallTalk, Scheme, Lisp, Python and Ruby (I’m fairly
sure there are some written in id.st (or Cola, whatever you want to call
it) as well ;-))

Just my two cents.

“You are now able to program any browser in the world with any language
you want”

Julian.


Buy my new album! 16 Sep 2010:
http://itunes.apple.com/au/album/erste-zeit/id393326346

Hi,

Consider this:

some_data.to_s.split("\n").each{|item| puts item}

how about an alternative syntax for the dot operator:

each{|item| puts item} of split("\n") of to_s of some_data

or, more intelligently:

this_school.students.addresses.map{|address| a.all_as_one_sentence}

map{|address| all_as_one_sentence of address} of addresses of students
of this_school

Just wondering if this is a possibility? :slight_smile:

julian.

On Fri, 8 Apr 2011 11:01:34 +0900, Chad P. wrote:

two sets of conditions are likely to apply here:

I’m not a lawyer, but I spend a lot of time trying to avoid giving
lawyers reason to contact me with bad news.

Please, treat all my words about implicit license as a form of bad
humor.
It does not incorporate any external code, just mine, and I always
intended
to use the Ruby license, but it somehow got not included in the git
tree.

Thanks for your efforts.

On Fri, Apr 8, 2011 at 3:34 AM, Julian L.
[email protected]wrote:

or, more intelligently:

this_school.students.addresses.map{|address| a.all_as_one_sentence}

map{|address| all_as_one_sentence of address} of addresses of students of
this_school

Just wondering if this is a possibility? :slight_smile:

julian.

I don’t think my brain would be very fond of this, I like starting with
the
thing I know and applying a series of transformations to it via methods
to
turn it into the thing I want. I feel like I’d have to keep jumping to
the
right to see what I have, and then back to the left to see what I’m
doing to
it.

join of map(&:name) of students
join of map(&:name) of courses

They are the same until the very end, so you can’t know what you’re
talking
about until after you’re done talking about it.

But maybe if I experienced I’d become more familiar some way of thinking
that fits better with this syntax. Maybe in practice, it would only be
used
in situations like name of student where it feels natural and the
context
is straightforward, and not in situations like join of array where
join is
an action rather than an attribute.

IDK, I’d try it out if someone went and did it, but I don’t think I’d
advocate that someone put forth the effort to do it otherwise (though it
might not be very difficult, might just require a handful of lines of
yacc
or something)

That is incredibly cool! But can you really implement any language?
What about languages that are completely different from javascript?
In Haskell, for example, everything happens lazily, data is
immutable, there is a complex type system. Can you really map this
right to javascript? (or am I misunderstanding OMeta?)

My take here is full of handwaving. I’ll admit I’ve never of O-Meta
before.

Comp sci point of view:
OMeta is turing complete? If so then by universality it is possible.

Further, OMeta can run C#, it doesn’t take a huge stretch of the
imagine to say it can run C. Haskell can compile to C*. Therefore it can
run Haskell.

The best way to do it though would be to port the STG-Machine** into
O-meta. Fun!

** See “Implementing lazy functional languages on stock hardware: the
Spineless Tagless G-machine”, Simon Peyton Jones 1992. The link on SPJ’s
website is dead unforunately :frowning:

I’ve been tempted to port STG into ruby before. Or maybe just
G-Machine because it’s simpler. It just sounds like a fun little
project.

Sorry for yet another random long interjection on functional
programming. SIGH.

In Haskell, for example, everything happens lazily, data is
immutable, there is a complex type system.

Also, if you’ve already proved the program shouldn’t crash due
to type errors, you don’t need to check any types as you run.

On Thu, Apr 7, 2011 at 11:46 PM, Julian L.
[email protected]wrote:

most common programming languages already (which means the target language
“You are now able to program any browser in the world with any language you
want”
OMeta - JavaScript as Assembly - YouTube

Julian.

That is incredibly cool! But can you really implement any language?
What
about languages that are completely different from javascript? In
Haskell,
for example, everything happens lazily, data is immutable, there is a
complex type system. Can you really map this right to javascript? (or am
I
misunderstanding OMeta?)

On Apr 8, 2011, at 01:34 , Julian L. wrote:

or, more intelligently:

this_school.students.addresses.map{|address| a.all_as_one_sentence}

map{|address| all_as_one_sentence of address} of addresses of students of
this_school

Just wondering if this is a possibility? :slight_smile:

No. You want python or (gulp) applescript.

On 2011-04-08, at 12:02, Ryan D. wrote:

On Apr 8, 2011, at 01:34 , Julian L. wrote:


each{|item| puts item} of split("\n") of to_s of some_data

No. You want python or (gulp) applescript.

Actually, you want COBOL. Think about that :slight_smile: – vincent

Do we actually need to have full ruby spec implemented? Don’t forget
about the 20/80 rule of the universe - there are only 20 % of features
that provide 80% of value.

It seems that it’s impossible in any time soon to create a full-featured
Ruby JS. There were lots of project of this kind (HotRuby, RubyJS, Red,
… google github) and it seems that all of them are dead by now,
although some of them got some attention in past.

But look at the success of CoffeeScript, it doesn’t try to solve all
problems at once, but it eliminates the most annoying problems.

Maybe it would be better do it in the same way? Take the core part, that
can be easily implemented and leave the rest to the better time?

I mean - the most valuable part (for me) would be the ruby syntax,
blocks, naming conventions, core library method names and semantic. And
if there would be the Prototypical model instead of Ruby Object Model -
it’s not a big deal. The Prototypical model is also very powerfull, and
JS problems are mainly from the bad implementation of the Prototypical
model not from the model itself.