Need Help on Ruby Details

Hi Everyone,

I am shooting in the dark here. I have few very significant questions
regarding Ruby. It is new to me, and I cannot find sufficient help at
Barnes & Nobles. In other words HELP HELP HELP.

Here are my questions. Also I am in need of a pretty technical
details, etc.

1) How does ruby handle choice and repetition? I need to know the guts
of the choice and repetition.

2) How does ruby support branches, loops, and recursion? I am not
looking for the syntax on language. I am looking for the real detail
on how it is done behind the scenes.

3) I need to know the local flow of control and the global flow of
control. I.E. Global provisions for transfer of the control; I know
that functions do not exist in Ruby, rather a global object member is
created. I cannot find this in Intro books that I have access to. ANy
help is welcome.

4) Does ruby have a go to statement embedded in the language?

Again thank you for looking and may be even helping me out. I have
read bunch of guides and learning materials for the ruby, however, I
need some real info that is hard to find.

Sincerely,
Roman

----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---

I don't understand your first question at all; for your middle
questions, I can only suggest reading the source. The last question is
an unequivocal no. However, there are ways to simulate it, and there's
a project on the RAA that sort-of implements it.

-austin

···

On Fri, 15 Oct 2004 02:09:31 +0900, Roman K9 <litleguy@bendbroadband.com> wrote:

--
Austin Ziegler * halostatue@gmail.com
               * Alternate: austin@halostatue.ca
: as of this email, I have [ 5 ] Gmail invitations

I am shooting in the dark here. I have few very significant questions
regarding Ruby. It is new to me, and I cannot find sufficient help at
Barnes & Nobles. In other words HELP HELP HELP.

I am in part guessing what you want to know. You may want to look at

http://www.rubycentral.com/book/

for more information. If you want a paper copy, the new edition of this
book should be in the stores in a few weeks.

Here are my questions. Also I am in need of a pretty technical
details, etc.

1) How does ruby handle choice and repetition? I need to know the guts
of the choice and repetition.

     Choice provides lots of choice:

          case s
             when 'bob' then puts 'Hi bob!'
             when /q[^u]/i
                puts 'Q must always be followed by U'
             else
                puts "Fried cheese!"
             end

or

     if cond then print "true" else print "false" end

or

     if i < 0
          print "negative"
        elsif i > 0
           print "positive"
         else
            print "zero"
         end

or

       (i < 0) ? 0 : i

and so forth.

Likewise, there are things like

    5.times do ... end
    (i..2*i).each { |x| ...}
    loop {... break...next...}
    ['tree','frog','elf','taxes',3.14159].each { |item| ...}

and for loops, and...

2) How does ruby support branches, loops, and recursion? I am not
looking for the syntax on language. I am looking for the real detail
on how it is done behind the scenes.

     For the real details behind the scenes, read the source. For the
syntax, see the link mentioned above or look at any of the sample code
that comes with ruby. Or, if you really must know the absolute details
of the syntax (not recommended) you can look at the grammar in parse.y

3) I need to know the local flow of control and the global flow of
control. I.E. Global provisions for transfer of the control; I know
that functions do not exist in Ruby, rather a global object member is
created. I cannot find this in Intro books that I have access to. ANy
help is welcome.

     I do not understand this question. The answer may be
"continuations", "read the source", "no", "threads", "yes",
"method/closure", or "flying monkeys." That is how unsure I am of what
you are asking.

4) Does ruby have a go to statement embedded in the language?

     No.

···

Again thank you for looking and may be even helping me out. I have
read bunch of guides and learning materials for the ruby, however, I
need some real info that is hard to find.

Hi Roman,

Your mail seemed very intriguing: If you don't have to violate
copyrights or NDA's to do so, please tell us what you are up to. I would
very much like to know.

kaspar

semantics & semiotics
code manufacture

www.tua.ch/ruby

Roman K9 ha scritto:

people already answered that you should be little more specific and probably you'd find answers only in the source.
I wonder why you want to know that, anyway :slight_smile:

And, ruby does not have GOTOs but we have callcc, so we can emulate:

def goto(cont)
   cont.call(cont)
end

puts "start"
label = callcc{|k| k}
puts "loopy"
goto label
raise "explode!!!"

I am diggin myself into ruby. As in C/C++/C#, Ruby must have tons of
unknown details. Most published books are weak if not wrong. I am
digging through the source right now. Can't tell you more details.
Thanks for the reply,
Roman

···

On Fri, 15 Oct 2004 17:43:15 +0900, Kaspar Schiess <eule@space.ch> wrote:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Roman,

Your mail seemed very intriguing: If you don't have to violate
copyrights or NDA's to do so, please tell us what you are up to. I would
very much like to know.

kaspar

semantics & semiotics
code manufacture

www.tua.ch/ruby
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFBb4+PFifl4CA0ImQRAmXvAJ9m7F/UEw0vHox0iiNf974/lao1WwCgqC9Z
fHTU9Rq5gVkm3yEqTmcFEw0=
=zqbk
-----END PGP SIGNATURE-----

----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---

This thread becomes stranger with every posting: you're new to Ruby but
you want to start with the inner workings of the language and interpreter.
Why don't you just start applying Ruby to learn the concepts and dig
deeper afterwards? I suspect you might not be able to see the forest for
the trees...

I have definitely the feeling that you're after something different from
learning the language. Care to unveil your aims?

    robert

"Roman K9" <litleguy@bendbroadband.com> schrieb im Newsbeitrag
news:2fbvm09fd3lumc19pt72s6n48vj81pmtri@4ax.com...

I am diggin myself into ruby. As in C/C++/C#, Ruby must have tons of
unknown details. Most published books are weak if not wrong. I am
digging through the source right now. Can't tell you more details.
Thanks for the reply,
Roman

>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA1
>
>Hi Roman,
>
>Your mail seemed very intriguing: If you don't have to violate
>copyrights or NDA's to do so, please tell us what you are up to. I

would

>very much like to know.
>
>kaspar
>
>semantics & semiotics
>code manufacture
>
>www.tua.ch/ruby
>-----BEGIN PGP SIGNATURE-----
>Version: GnuPG v1.2.4 (MingW32)
>Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
>
>iD8DBQFBb4+PFifl4CA0ImQRAmXvAJ9m7F/UEw0vHox0iiNf974/lao1WwCgqC9Z
>fHTU9Rq5gVkm3yEqTmcFEw0=
>=zqbk
>-----END PGP SIGNATURE-----
>
>

----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet

News==----

http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000

Newsgroups

···

On Fri, 15 Oct 2004 17:43:15 +0900, Kaspar Schiess <eule@space.ch> > wrote:
---= East/West-Coast Server Farms - Total Privacy via Encryption =---

I thought "The Ruby Way" was a very good book and "Programming Ruby: The Pragmatic Programmer's Guide (Second Edition)" may just be the best programming volume I've ever read. Your mileage may vary.

James Edward Gray II

···

On Oct 15, 2004, at 6:04 AM, Roman K9 wrote:

I am diggin myself into ruby. As in C/C++/C#, Ruby must have tons of
unknown details. Most published books are weak if not wrong. I am
digging through the source right now. Can't tell you more details.

The original post seemed almost like a homework assignment.

···

On Fri, 15 Oct 2004 20:24:29 +0900, Robert Klemme <bob.news@gmx.net> wrote:

I have definitely the feeling that you're after something different from
learning the language. Care to unveil your aims?

    robert