[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: External Ruby Script in HTML

Peña, Botp

12/22/2006 10:21:00 AM

From: list-bounce@example.com:
# Let's say I have a ruby script called hello.rb
#
# #!/usr/bin/ruby
# def greeting ()
# return "Hello world!"
# end
#
# I want to call that script from within an HTML document. How
# would I do
# so? Within the HTML document, would I just treat it the same
# way I call
# external javascript:
#
# <script src="path/to/hello.rb" type="text/ruby"></script>
#
# How would I make the function call?

if you mean like javascript, there is something close, and it's activescriptruby http://www.geocities.co.jp/SiliconValley-PaloAlto/9251/ruby...

close since it runs only on windows ie.

hope someone would write a ruby equivalent to javascript. that would be a killer.

kind regards -botp



8 Answers

David Vallner

12/22/2006 12:32:00 PM

0

Peña wrote:
> hope someone would write a ruby equivalent to javascript. that would be a killer.
>

It's rather unprobable this will happen. Firstly, JavaScript is
standardised, for better or worse. I've seen the first bout of browser
wars, I've seen the second, Lite edition (e.g. how much of Dojo will
break on $BROWSER) - yay, very subtly incompatible handling of
window.location.href updates and onload/onclose events; I don't want to
see the third bout, aka how many scripting language interpreters will
you bundle with or half-assedly reimplement in $BROWSER.

Not to mention the development principles of the two languages (or
rather standard libraries) are almost contrary, you'd have to rip out
and retrofit significant amounts of Ruby to be able to embed it safely.

David Vallner

Martin DeMello

12/22/2006 6:35:00 PM

0

On 12/22/06, Peña, Botp <botp@delmonte-phil.com> wrote:
>
> hope someone would write a ruby equivalent to javascript. that would be a killer.

javascript is a rubyer language than it looks:

http://whytheluckystiff.net/clog/ruby/ruby...

martin

Marc Heiler

12/22/2006 10:46:00 PM

0

For someone that likes Ruby, Javascript does not matter.
It feels like a crippled down, specialized language.

Ruby syntax would be a lot nicer.

And that Javascript is standardized doesnt make it
better. Its ok if everyone can use standardized
Javascript - but I personally, I'd dump Javascript
the moment it would be possible to live with
pure Ruby instead. But guess Javascript is stuck
for years ;)

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

David Vallner

12/23/2006 12:53:00 PM

0

Marc Heiler wrote:
> For someone that likes Ruby, Javascript does not matter.
> It feels like a crippled down, specialized language.
>

It's *supposed to be* specialised. Different roles and all that. Where
JS is used, you're not supposed to be expressing complex logic anyway.
Before anyone mentions Ajax, refer to my gruesome bias against the
hack^Wconcept. It's also *supposed to be* crippled. JS is a language for
a domain that requires restrictions first because of the possible impact
and woes fixing if there was a security issue with the language itself.

If I was a nastier person I'd say you're missing the point by leagues.
Oh, wait, I -am-, so, you are. Ruby wasn't around when the need for
scripting web browsers emerged. So, JS got into the standard. Standards
are the only thing that preserve the web from collapsing on itself in a
rain of tears and any touching them will lead to at best pain. (So, can
anyone recall actual use of XHTML 1.1 in the wild?). And even if Ruby
were around by then, it wouldn't be the Ruby you know, the domain itself
would necessitate crippling and specialisation. Allowing it to be used
"pure" is completely impossible.

By the way, you're confusing language and programming environment. JS
the language is, in terms of language power, incrementally or at worst
linearly inferior than Ruby the language, and could probably match it in
more features than you can think of. The standard library is Good Enough
for the task the language is primarily supposed to fulfill (script a
HTML rendering engine).

David Vallner

Rimantas Liubertas

12/23/2006 6:26:00 PM

0

<...>
> (So, can
> anyone recall actual use of XHTML 1.1 in the wild?).
<...>

Yeeep: http://golem.ph.utexas.edu/~dis...


Regards,
Rimantas
--
http://rim...

Martin DeMello

12/24/2006 1:18:00 AM

0

On 12/23/06, David Vallner <david@vallner.net> wrote:
>
> By the way, you're confusing language and programming environment. JS
> the language is, in terms of language power, incrementally or at worst
> linearly inferior than Ruby the language, and could probably match it in
> more features than you can think of. The standard library is Good Enough
> for the task the language is primarily supposed to fulfill (script a
> HTML rendering engine).

Anyone thinking of Javascript as crippled or inferior would do well to
take a look at http://w3future.com/h...

martin

ramalho@gmail.com

12/24/2006 10:03:00 AM

0

On 12/23/06, Martin DeMello <martindemello@gmail.com> wrote:
> Anyone thinking of Javascript as crippled or inferior would do well to
> take a look at http://w3future.com/h...

Very interesting, Martin. Thanks for the link.

But I must say I failed to notice how Loell would change the mind of
somebody who considers Javascript crippled or inferior (except to
demonstrate that Javascript is Turing Complete).

Cheers, and a healthy, peaceful and productive 2007 to all!

--
Luciano

Martin DeMello

12/24/2006 10:38:00 AM

0

On 12/24/06, Luciano Ramalho <ramalho@gmail.com> wrote:
> On 12/23/06, Martin DeMello <martindemello@gmail.com> wrote:
> > Anyone thinking of Javascript as crippled or inferior would do well to
> > take a look at http://w3future.com/h...
>
> Very interesting, Martin. Thanks for the link.
>
> But I must say I failed to notice how Loell would change the mind of
> somebody who considers Javascript crippled or inferior (except to
> demonstrate that Javascript is Turing Complete).

The guy obviously knows what he's doing, and he had a choice of
languages in which to implement his stuff - he clearly felt javascript
was up to it. I would never have tried something like that in java or
c, for instance.

martin