Rubyscript instead of javascript

It is just a thought. And I wouldn’t know anything about possible
problems implementing this,

but

wouldn’t be nice if rubyscript could be executed inside of browser just
like javascript does.

by
TheR

wouldn’t be nice if rubyscript could be executed inside of browser just
like javascript does.

Yeah. I think most people like Javascript, but I actually hate it.

Pretty all my code is in ruby, and I dont plan to add Javascript to this
at all.

On 5 Sep 2009, at 09:12, Damjan R. wrote:

It is just a thought. And I wouldn’t know anything about possible
problems implementing this,

but

wouldn’t be nice if rubyscript could be executed inside of browser
just
like javascript does.

There are several projects for getting Ruby into the browser, ranging
from Yahoo’s approach of a plugin that can run Ruby in parallel with
the browser to the HotRuby bytecode interpreter which is implemented
in JavaScript. As of yet none is a good solution for general-purpose
browser-side Ruby.

Ellie

Eleanor McHugh
Games With Brains
http://slides.games-with-brains.net

raise ArgumentError unless @reality.responds_to? :reason

There are several projects for getting Ruby into the browser, ranging
from Yahoo’s approach of a plugin that can run Ruby in parallel with
the browser to the HotRuby bytecode interpreter which is implemented
in JavaScript. As of yet none is a good solution for general-purpose
browser-side Ruby.

It should probably be done like a plugin. Like Flash. Since it already
can be compiled for numerous platforms porting to browsers shouldn’t be
a problem.

Of course security should be tightened and DOM must be implemented.

by
TheR

2009/9/5 Damjan R. [email protected]:

a problem.
The problem with yet another plugin is that everybody who visits your
site has to install it which may not be possible because they are
running a (mostly) readonly live-cd or an administratively locked-down
PC in an office (you even have to be administrator to install Explorer
plugins on WIndows). And then the plugin will be available only for
finite number of browser-platform combinations. If you are running a
different browser or a supported browser but on a different platform
you get no plugin.

That’s why Flash sucks.

Of course security should be tightened and DOM must be implemented.

Bindings for DOM in each browser in the world … or a compiler into
Javascript that already has them?

The fact DOM bindings are already present is Javascript and Javascript
(actually ECMA script) is widely supported is why there are projects
targeting this platform.

Thanks

Michal

On Saturday 05 September 2009 08:43:14 am Marc H. wrote:

wouldn’t be nice if rubyscript could be executed inside of browser just
like javascript does.

Yeah. I think most people like Javascript, but I actually hate it.

Really? I tend to find the opposite.

That is, most people who know a little Javascript and a lot of some
other
language hate Javascript. I actually know Javascript well enough that
I…
still hate it, but no more than I hate Ruby. Which is to say, I love it,
mostly.

I’d suggest starting here, if you want to really learn Javascript:

http://crockford.com/javascript/

Now, I do agree that I’d probably rather work with Ruby in the browser.
But I
don’t think it’s worth the hassle, at least until something like Google
Gears
gets widespread.

On Sat, Sep 5, 2009 at 4:12 AM, Damjan R.[email protected] wrote:

It is just a thought. And I wouldn’t know anything about possible
problems implementing this,

but

wouldn’t be nice if rubyscript could be executed inside of browser just
like javascript does.

Chris N. gave a quick presentation of Gestalt at Cincinnati.rb,
looks pretty sweet.

http://blog.jimmy.schementi.com/2009/07/gestalt-ruby-and-python-in-browser.html

Best,
Michael G.

On Sat, Sep 5, 2009 at 9:19 PM, Michael G.[email protected] wrote:

Chris N. gave a quick presentation of Gestalt at Cincinnati.rb,
looks pretty sweet.

Jimmy Schementi > Gestalt: Ruby and Python in the browser, again

Oops, clipboard mix up. Here’s the real project link:
http://visitmix.com/Labs/gestalt

Best,
Michael G.

Rome wasn’t build in a day and it would be wrong to force millions users
like for example Twitter users to download some plugin to be able to
continue visiting their beloved web site.

I see Ruby and Rails perticualy as ideal tool for building company
Intranets. Where the problem is that you usualy do not have enough
employes and learning another language, which is different enough, is
not productive.

It was stated on a lot of places that Ruby and Rails is easy to learn.
New employes tend to integrate into existing projects faster. Not to
mention productivity.

I also see Ruby as a language which might finaly replace Basic as
scripting language for all kind of complex applications. Imagine Ruby
and gems embaded into OpenOffice.

by
TheR

Well, Java is installed in most computers and there’s JRuby.

On Sep 5, 2009 5:53 PM, “Michal S.” [email protected] wrote:

2009/9/5 Damjan R. [email protected]:

There are several projects for getting Ruby into the browser, ranging
from Yahoo’s approach …
The problem with yet another plugin is that everybody who visits your
site has to install it which may not be possible because they are
running a (mostly) readonly live-cd or an administratively locked-down
PC in an office (you even have to be administrator to install Explorer
plugins on WIndows). And then the plugin will be available only for
finite number of browser-platform combinations. If you are running a
different browser or a supported browser but on a different platform
you get no plugin.

That’s why Flash sucks.

Of course security should be tightened and DOM must be implemented.
Bindings for DOM in each browser in the world … or a compiler into
Javascript that already has them?

The fact DOM bindings are already present is Javascript and Javascript
(actually ECMA script) is widely supported is why there are projects
targeting this platform.

Thanks

Michal

On 5 Sep 2009, at 16:57, Mario C. wrote:

Well, Java is installed in most computers and there’s JRuby.

It’s arguable as to whether Java or Flash is more widely distributed,
however with IE still the dominant browser environment I continue to
anticipate IronRuby for the Silverlight 2 platform.

Ellie

Eleanor McHugh
Games With Brains
http://slides.games-with-brains.net

raise ArgumentError unless @reality.responds_to? :reason

On 6 Sep 2009, at 08:50, Damjan R. wrote:

It was stated on a lot of places that Ruby and Rails is easy to learn.
New employes tend to integrate into existing projects faster. Not to
mention productivity.

JavaScript is ugly (to my eyes) but I wouldn’t say it was any more
difficult to learn than Ruby, and unless your team is comprised of
developers who only know Ruby and hence would be facing the learning-
my-second-language problem it’s unlikely to have a major impact on
overall productivity across the lifespan of any non-trivial project.

That said, if I could do browser-side coding in Ruby it would
certainly make me much happier.

I also see Ruby as a language which might finaly replace Basic as
scripting language for all kind of complex applications. Imagine Ruby
and gems embaded into OpenOffice.

It’s unlikely to happen anytime soon for the simple reason that Ruby
is still perceived as a niche language.

Ellie

Eleanor McHugh
Games With Brains
http://slides.games-with-brains.net

raise ArgumentError unless @reality.responds_to? :reason

On Sat, Sep 5, 2009 at 6:58 PM, David M. [email protected]
wrote:

Really? I tend to find the opposite.

That is, most people who know a little Javascript and a lot of some other
language hate Javascript.

As someone who works with JavaScript on a daily basis, programming in it
some and working with tools to support it the rest of the time, I really
loathe JavaScript.

JavaScript tries to force everything into a universal abstraction (the
object) and yet that universal abstraction doesn’t even work
consistently.

Take, for example:

[].prototype

gasp It’s undefined! How can we check if something is an array? I
suppose this works, albeit painfully so:

[].constructor.toString().indexOf(“Array”) != -1

The typical retort I hear from those who like JavaScript is that if you
ever
need to do ^^^ you’re writing your program wrong, however I’d just like
to
add a bit of polymorphism and it seems like it requires a huge hack.

Also rather unintuitive and nonsensical is the behavior of the coercing

operator. For example:

NaN == NaN

…is false! We lack basic reflexivity. Even worse:

if([]) { … }

…is true, in a boolean context [] gets coerced into a true value,
however…

if([] == false) { … }

…is also true! When coerced by the == comparison operator [] gets
coerced
an entirely different way.

I’m not sure how JavaScript wound up being so painfully inconsistent.

On Sun, Sep 6, 2009 at 3:28 PM, Tony A. [email protected] wrote:

For example:

NaN == NaN

…is false! We lack basic reflexivity.

Although it appears Ruby behaves the same way:

NaN = 0.0/0
=> NaN
NaN == NaN
=> false

2009/9/5 Mario C. [email protected]:

Well, Java is installed in most computers and there’s JRuby.

Sure having Java installed does not automatically mean that it works
in your browser, too.

And it’s no longer the web. AFAIK Java in browsers is just like movies
in browsers - it just runs in part of the browser window but has no
relation to the originating web page whatsoever - you could equally
well save the applet and run it in a separate window.

On the other hand, JavaScript allows for small pieces of code that
modify the HTML pages in the browser without redownloading the page
from the server.

Thanks

Michal

On Sunday 06 September 2009 04:28:30 pm Tony A. wrote:

On Sat, Sep 5, 2009 at 6:58 PM, David M. [email protected] wrote:

As someone who works with JavaScript on a daily basis, programming in it
some and working with tools to support it the rest of the time, I really
loathe JavaScript.

So do I, just no more than any other language I’ve had to work with
enough to
understand it thoroughly.

JavaScript tries to force everything into a universal abstraction (the
object) and yet that universal abstraction doesn’t even work consistently.

You could say the same for Ruby, certainly. Indeed, we try to use “duck
typing” for most things, yet the type of an object suddenly matters when
you
want to bind an UnboundMethod.

Or, to take another example, every object can have singleton methods
defined,
like so:

foo = “foo”
class << foo
def bar
:baz
end
end
foo.bar

Not that this is useful, but try doing it to an integer. That is:

foo = 5
class << foo

Doesn’t work. I can’t think of a good reason it shouldn’t work. After
all, you
can define instance variables on integers:

5.instance_variable_set :@foo, :bar
5.instance_variable_get :@foo

Not that this has actually bitten me in practice, of course. Other
things,
like the difference between symbols and strings, seem much more likely
to
confuse people.

The typical retort I hear from those who like JavaScript is that if you
ever need to do ^^^ you’re writing your program wrong, however I’d just
like to add a bit of polymorphism and it seems like it requires a huge
hack.

Similarly, if you need to know with absolute certainty whether a Ruby
object
will respond to a method, before sending the method – or whether an
object is
of a certain type – you’re doing it wrong.

But if you think about it, you’re basically wanting to know whether
something’s an Array or an object, right? Because if you were wanting
any of
the other basic types, it would be something you could check with
‘typeof’, if
nothing else.

Also rather unintuitive and nonsensical is the behavior of the coercing ==
operator. For example:

NaN == NaN

…is false!

I’m fairly sure something similar going on here:

[] == [] is false.
[] == ![] is true.

It’s sort of an A is not A problem.

These are weird little warts, but frankly, they bother me far less than
when I
have issues with the design itself. For example, I can probably abstract
away
those annoyances, but it’s harder to abstract away something like this:

class Hello {
public static void main(String [] args) {
System.out.println(“Hello, world!”);
}
}

That is, I find Javascript’s ugliness to be skin-deep, while Java’s
ugliness is
pervasive.

At the end of the day, I suppose it’s a matter of taste, and we’d
probably all
be much better off with a common VM in the browser (something like Java
or
Flash, but more closely tied to the DOM, and standard), so that no one
is
forced into one language or another.

Tony A. wrote:

On Sun, Sep 6, 2009 at 3:28 PM, Tony A. [email protected] wrote:

For example:

NaN == NaN

…is false! We lack basic reflexivity.

Although it appears Ruby behaves the same way:

NaN = 0.0/0
=> NaN
NaN == NaN
=> false

This particular example has nothing to do with coercion, and everything
to do with IEEE floating point implementation. It’s also correct, in
both cases.


Alex

On 7 Sep 2009, at 02:49, David M. wrote:

At the end of the day, I suppose it’s a matter of taste, and we’d
probably all
be much better off with a common VM in the browser (something like
Java or
Flash, but more closely tied to the DOM, and standard), so that no
one is
forced into one language or another.

It seems that’s part of Microsoft’s thinking with Silverlight and the
Mono project’s Moonlight Linux/X11 implementation could make it a
credible platform.

Ellie

Eleanor McHugh
Games With Brains
http://slides.games-with-brains.net

raise ArgumentError unless @reality.responds_to? :reason

On Monday 07 September 2009 05:53:13 am Eleanor McHugh wrote:

Mono project’s Moonlight Linux/X11 implementation could make it a
credible platform.

It looks interesting, but I have several concerns:

  • Mono always seems to be several steps behind .NET.
  • Microsoft has helped Mono and Moonlight, because they’re fighting
    Flash. If
    Flash dies, that support may simply be dropped.
  • Software patents?
  • Forces users to download a third-party plugin.
  • Tons of additional crap, like XAML. Do we need it? I could be
    convinced,
    but I’d rather see it built on top of a simpler runtime, to ease
    third-party
    implementation.
  • Is this the best we could do? Microsoft built Silverlight on .NET
    because
    they’re Microsoft, and it’s .NET. Is it the best VM for the job?

What I’ve heard suggested instead is to take Adobe’s Tamarin engine,
merge it
into open browsers like Firefox, and let Adobe quietly push it into IE
via
Flash. This has the advantage that everyone already has Flash, and Flash
generally stays up to date somehow or other, so it would be instant,
widespread adoption – yet the Flash would be a hack for where the
standard
itself isn’t supported.

That’s a powerful platform – if that’s the direction Adobe is going. I
have
no idea – a quick Google doesn’t show whether any other languages
target
Flash, or could reasonably target Flash.

An example of where this kind of scheme might already be working well is
the
HTML5 video tag – it can be made to gracefully degrade into a Flash
player,
and depending on the format you choose, it could even be the same video
stream
for either.

On 8 Sep 2009, at 10:40, Jörg W Mittag wrote:

Also, to this day, Flash for Linux is only available for 32-Bit x86
processors (which is pretty much exactly 0% of computers sold in the
last 2 years, with the exception of netbooks), and only for a small
number of distributions and browsers (excluding, for example, Opera).

I’d also like to point out that the stability of the OS X port of
Flash leaves a lot to be desired. It regularly crashes Safari on my
machines.

Ellie

Eleanor McHugh
Games With Brains
http://slides.games-with-brains.net

raise ArgumentError unless @reality.responds_to? :reason