Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.ruby > #2430 > unrolled thread

can we use direct ruby instaed of javascript ?

Started bySniper Abandon <sathish.salem.1984@gmail.com>
First post2011-04-07 01:44 -0500
Last post2011-04-11 09:07 -0500
Articles 7 on this page of 27 — 14 participants

Back to article view | Back to comp.lang.ruby


Contents

  can we use direct ruby instaed of javascript ? Sniper Abandon <sathish.salem.1984@gmail.com> - 2011-04-07 01:44 -0500
    Re: can we use direct ruby instaed of javascript ? Dhruva Sagar <dhruva.sagar@gmail.com> - 2011-04-07 01:52 -0500
      Re: can we use direct ruby instaed of javascript ? Michal Suchanek <hramrach@centrum.cz> - 2011-04-07 08:00 -0500
    Re: can we use direct ruby instaed of javascript ? Sniper Abandon <sathish.salem.1984@gmail.com> - 2011-04-07 02:33 -0500
      Re: can we use direct ruby instaed of javascript ? Dhruva Sagar <dhruva.sagar@gmail.com> - 2011-04-07 03:17 -0500
    Re: can we use direct ruby instaed of javascript ? Mike Stephens <rubfor@recitel.net> - 2011-04-07 07:28 -0500
    Re: can we use direct ruby instaed of javascript  ? Peter Zotov <whitequark@whitequark.org> - 2011-04-07 07:50 -0500
      Re: can we use direct ruby instaed of javascript   ? Peter Zotov <whitequark@whitequark.org> - 2011-04-07 15:37 -0500
        Re: can we use direct ruby instaed of javascript   ? Julian Leviston <julian@coretech.net.au> - 2011-04-07 23:46 -0500
          Re: can we use direct ruby instaed of javascript ? Josh Cheek <josh.cheek@gmail.com> - 2011-04-08 08:03 -0500
            Re: can we use direct ruby instaed of javascript ? Johnny Morrice <spoon@killersmurf.com> - 2011-04-08 08:20 -0500
            Re: can we use direct ruby instaed of javascript ? Johnny Morrice <spoon@killersmurf.com> - 2011-04-08 08:34 -0500
            Re: can we use direct ruby instaed of javascript ? Michal Suchanek <hramrach@centrum.cz> - 2011-04-11 04:45 -0500
              Re: can we use direct ruby instaed of javascript ? Phillip Gawlowski <cmdjackryan@googlemail.com> - 2011-04-11 05:34 -0500
                Re: can we use direct ruby instaed of javascript ? Michal Suchanek <hramrach@centrum.cz> - 2011-04-11 07:59 -0500
              Re: can we use direct ruby instaed of javascript ? William Rutiser <wruyahoo05@comcast.net> - 2011-04-11 09:48 -0500
                Re: can we use direct ruby instaed of javascript ? Johnny Morrice <spoon@killersmurf.com> - 2011-04-11 11:53 -0500
                  Re: can we use direct ruby instaed of javascript ? Johnny Morrice <spoon@killersmurf.com> - 2011-04-11 11:57 -0500
        "of" keyword? inverse dot syntax... Julian Leviston <julian@coretech.net.au> - 2011-04-08 03:34 -0500
          Re: "of" keyword? inverse dot syntax... Josh Cheek <josh.cheek@gmail.com> - 2011-04-08 07:52 -0500
          Re: "of" keyword? inverse dot syntax... Ryan Davis <ryand-ruby@zenspider.com> - 2011-04-08 14:02 -0500
            Re: "of" keyword? inverse dot syntax... Vincent Manis <vmanis@telus.net> - 2011-04-08 20:42 -0500
            Re: "of" keyword? inverse dot syntax... Yossef Mendelssohn <ymendel@pobox.com> - 2011-04-09 18:13 -0500
        Re: can we use direct ruby instaed of javascript    ? Peter Zotov <whitequark@whitequark.org> - 2011-04-08 04:47 -0500
    Re: can we use direct ruby instaed of javascript ? Alexey Petrushin <axyd80@gmail.com> - 2011-04-09 22:58 -0500
    Re: can we use direct ruby instaed of javascript ? Josh Cheek <josh.cheek@gmail.com> - 2011-04-11 08:17 -0500
      Re: can we use direct ruby instaed of javascript ? Phillip Gawlowski <cmdjackryan@googlemail.com> - 2011-04-11 09:07 -0500

Page 2 of 2 — ← Prev page 1 [2]


#2546 — Re: "of" keyword? inverse dot syntax...

FromRyan Davis <ryand-ruby@zenspider.com>
Date2011-04-08 14:02 -0500
SubjectRe: "of" keyword? inverse dot syntax...
Message-ID<A9368816-8984-4D92-91C9-212C89B0B063@zenspider.com>
In reply to#2519
On Apr 8, 2011, at 01:34 , Julian Leviston wrote:

> 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? :)

No. You want python or (*gulp*) applescript.

[toc] | [prev] | [next] | [standalone]


#2567 — Re: "of" keyword? inverse dot syntax...

FromVincent Manis <vmanis@telus.net>
Date2011-04-08 20:42 -0500
SubjectRe: "of" keyword? inverse dot syntax...
Message-ID<45082EF1-A791-4CBA-A709-7927EB793F23@telus.net>
In reply to#2546
[Note:  parts of this message were removed to make it a legal post.]


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

> 
> On Apr 8, 2011, at 01:34 , Julian Leviston 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 :) -- vincent

[toc] | [prev] | [next] | [standalone]


#2590 — Re: "of" keyword? inverse dot syntax...

FromYossef Mendelssohn <ymendel@pobox.com>
Date2011-04-09 18:13 -0500
SubjectRe: "of" keyword? inverse dot syntax...
Message-ID<4f186fd4-bc04-4016-8c09-0061cc054731@2g2000vbl.googlegroups.com>
In reply to#2546
On Apr 8, 2:02 pm, Ryan Davis <ryand-r...@zenspider.com> wrote:
> On Apr 8, 2011, at 01:34 , Julian Leviston wrote:
> > Just wondering if this is a possibility? :)
>
> No. You want python or (*gulp*) applescript.

AppleScript was my first thought, and this "of" stuff is quite
possibly what I hate the most about trying to do anything in that
language.

--
-yossef

[toc] | [prev] | [next] | [standalone]


#2520 — Re: can we use direct ruby instaed of javascript ?

FromPeter Zotov <whitequark@whitequark.org>
Date2011-04-08 04:47 -0500
SubjectRe: can we use direct ruby instaed of javascript ?
Message-ID<ec713e31796d87fecb17d90259cad41a@mail.whitequark.org>
In reply to#2485
 On Fri, 8 Apr 2011 11:01:34 +0900, Chad Perrin wrote:
> On Fri, Apr 08, 2011 at 05:37:49AM +0900, Peter Zotov wrote:
>> On Fri, 8 Apr 2011 01:48:58 +0900, Chad Perrin 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.

 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.

-- 
   WBR, Peter Zotov.

[toc] | [prev] | [next] | [standalone]


#2592

FromAlexey Petrushin <axyd80@gmail.com>
Date2011-04-09 22:58 -0500
Message-ID<3ca195f73f5a3a8c4a308db41833f879@ruby-forum.com>
In reply to#2430
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?

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

[toc] | [prev] | [next] | [standalone]


#2629

FromJosh Cheek <josh.cheek@gmail.com>
Date2011-04-11 08:17 -0500
Message-ID<BANLkTimM+8se0ZRxcTDSWAezNx4A8UZpxQ@mail.gmail.com>
In reply to#2430
[Note:  parts of this message were removed to make it a legal post.]

Accidentally went off list for a bit.

On Mon, Apr 11, 2011 at 7:55 AM, Michal Suchanek <hramrach@centrum.cz>wrote:

> On 11 April 2011 14:35, Josh Cheek <josh.cheek@gmail.com> wrote:
> > On Mon, Apr 11, 2011 at 7:30 AM, Josh Cheek <josh.cheek@gmail.com>
> wrote:
> >>
> >> On Mon, Apr 11, 2011 at 6:48 AM, Michal Suchanek <hramrach@centrum.cz>
> >> wrote:
> >>>
> >>> On 11 April 2011 12:02, Josh Cheek <josh.cheek@gmail.com> wrote:
> >>> > On Mon, Apr 11, 2011 at 4:40 AM, Michal Suchanek <
> hramrach@centrum.cz>
> >>> > wrote:
> >>> >>
> >>> >> On 8 April 2011 15:03, Josh Cheek <josh.cheek@gmail.com> wrote:
> >>> >> > 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?)
> >>> >> >
> >>> >>
> >>> >> This is incredibly cool but can you really translate any language
> into
> >>> >> machine code?
> >>> >> What about languages that are completely different from machine
> code?
> >>> >> In Haskell, for example, everything happens lazily, data is
> immutable,
> >>> >> there is a complex type system. Can you really map this right to
> >>> >> machine code? (Or am I misunderstanding your question?)
> >>> >>
> >>> >> Thanks
> >>> >>
> >>> >> Michal
> >>> >
> >>> > Your phraseology is confusing, but yes, I assume you are
> >>> > misunderstanding my
> >>> > question. In the video, he didn't translate to machine code, he
> >>> > translated
> >>> > to javascript which he then interpreted (at least that is how I
> >>> > understand
> >>> > it). Also, I am also pretty confident that Haskell doesn't map
> straight
> >>> > into
> >>> > machine code, I think it must embed a runtime to manage things like
> >>> > thunks
> >>> > and garbage collection.
> >>> >
> >>>
> >>> And how is translating to JavaScript different from translating to
> >>> machine code?
> >>>
> >>> Thanks
> >>>
> >>> Michal
> >>
> >> First of all, can JS even generate and execute machine code? I'd expect
> >> that to require knowledge of the platform and to be handled within the
> >> interpreter, not at the language level. IDK, I'll assume we mean
> assembly
> >> code for the rest of the post.
> >>
> >> Assembly (x86, anyway, IDK anything at all about any other kinds) is
> based
> >> on a certain infrastructure such as a stack, a heap, registers that keep
> >> track of where you are at in your code, where you are at on the stack,
> and
> >> so forth (I'm not positive these registers *must* be used this way, but
> at
> >> least that is how I've always seen them used). AFAIK, JS doesn't have
> these
> >> inherently. You could construct a framework that mimics a computer, and
> then
>
> Presumably OMeta is as complete as x86 assembly. Quite likely it has
> different set of primitives (or insctructions) but that does not mean
> translating to it is any more challenging than to x86 assembly to
> which all the named languages were translated already.
>
>
Ruby isn't translated to Assembly, you must interpret it.


> >> recreate the assembly instruction set but :
> >>
> >> (a) that isn't what he did in the video
> >>
> >> (b) if your language requires a runtime, then it isn't translatable.
> Maybe
> >> you could embed the runtime into the output program, but does it count
> as a
> >> translation if you break 1:1 relationship between before and after code?
> >> Even compiled languages don't do this, joining libraries is done by the
> >> linker, after the code is translated. (I'm not clear on the difference
> >> between assemblers and compilers)
> >>
> >> (c) by mapping into JS, don't you lose all the qualities that the
> language
> >> has on its own? ie you have the weaknesses of your actual language on
> top of
> >> the languages of JS (ie I would expect C to be slower than JS now,
> because
> >> your C is being translated into what appears to be assembly
> instructions,
> >> but is actually JS, and your final code is actually a whole series of
> >> indirect JS commands) So if this is the case, you have a leaky
> abstraction
> >> (http://www.joelonsoftware.com/articles/LeakyAbstractions.html)
>
> I don't see the leak anywhere, nor do I see any reason to translate C to
> JS.
>
>
The hypothesis was that you could implement *any* language. C falls within
that set. The leak is that JavaScript does not have the properties of
assembly. There is a reason you don't write systems level code with
interpreted languages, because they have very different properties. Wouldn't
implementing a systems level language in an interpreted language cause the
systems level language to lose the attributes that make it a viable choice
for such a domain?

>>
> >>
> >> Anyway, if you read my post, you'll see I didn't assert that it can't be
> >> done, I just asked whether it could. If you think it can and it's
> obvious,
> >> then how about an explanation of the process. If not, then why do you
> keep
> >> asking me these questions? I'm not an expert on the domain, I just
> watched
> >> the video.
> >
> > Also, why are we off list?
> >
> Because some three emails back you sent the email only to me, not the list.
>
>
Hmm, seems to be because you CC'd me in your response to the ML, so when I
hit reply, gmail sent it to you instead of the list. I changed the recipient
of this one, hopefully we're back on list. You might change your client to
avoid that, it seems unlikely that I'll be the only one to do this.

[toc] | [prev] | [next] | [standalone]


#2633

FromPhillip Gawlowski <cmdjackryan@googlemail.com>
Date2011-04-11 09:07 -0500
Message-ID<BANLkTimgk=DJzBKzTGkrBU1QKKyh8mi0Ow@mail.gmail.com>
In reply to#2629
On Mon, Apr 11, 2011 at 3:17 PM, Josh Cheek <josh.cheek@gmail.com> wrote:
>
> Ruby isn't translated to Assembly, you must interpret it.

YARV generates byte code. The byte code is interpreted by the Ruby VM.
The Ruby VM runs on an operating system. The Operating system runs on
machine code.

Ruby *can* run on machine code, or it wouldn't run at all. The
question is how many intermediary steps are needed to get it running,
and at what costs (it's generally easier, it appears, to run a dynamic
language on some sort of interpreter, if only to make an abstraction
only once).


> The hypothesis was that you could implement *any* language. C falls within
> that set. The leak is that JavaScript does not have the properties of
> assembly.

It doesn't need them. The compiler takes care of that.

Since IE9 was just released to the general public, here's an MSDN
article on Chakra:
http://blogs.msdn.com/b/ie/archive/2010/03/18/the-new-javascript-engine-in-internet-explorer-9.aspx

IE9 is a latecomer to the "compile JS" party, too. Google's V8 is one
of the first.

> There is a reason you don't write systems level code with
> interpreted languages, because they have very different properties. Wouldn't
> implementing a systems level language in an interpreted language cause the
> systems level language to lose the attributes that make it a viable choice
> for such a domain?

That's a question of optimization.

Even GCC has several optimization switches; some more, some less
dangerous to apply to code.

C's whole reason of existence is that it is a higher level language
than assembly with the compiler taking care of translating the
constructs of the higher level language into something that a CPU
understands.

> Hmm, seems to be because you CC'd me in your response to the ML, so when I
> hit reply, gmail sent it to you instead of the list. I changed the recipient
> of this one, hopefully we're back on list. You might change your client to
> avoid that, it seems unlikely that I'll be the only one to do this.

Yup, back on list. Though, IME GMail doesn't change the reply-to
header (maybe it got borked somewhere).

-- 
Phillip Gawlowski

Though the folk I have met,
(Ah, how soon!) they forget
When I've moved on to some other place,
There may be one or two,
When I've played and passed through,
Who'll remember my song or my face.

[toc] | [prev] | [standalone]


Page 2 of 2 — ← Prev page 1 [2]

Back to top | Article view | comp.lang.ruby


csiph-web