[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Re: [Adv] Ruby Tutorial for beginners

Kevin Olemoh

10/14/2006 3:17:00 AM

Neat thanks for the heads up.

On 10/14/06, Dibya Prakash <prakash.dibya@gmail.com> wrote:
> Hi All,
>
> This is to let you know that my good friend, Satish Talim has put together
> an excellent site – Learning Ruby here –
> http://sitekreator.com/satishtalim/...
>
> This is based on his Ruby study notes made while he studied Ruby himself,
> from various online Ruby resources like tutorials, blogs and Ruby
> documentation. A site I would definitely recommend for Ruby newbies.
>
> Thanks
> Dibya Prakash
>
>

9 Answers

Kevin Olemoh

10/14/2006 3:21:00 AM

0

One quick question in one of his examples he states that using single
quotes for strings is more efficient, why is this?

On 10/14/06, Kevin Olemoh <darkintent@gmail.com> wrote:
> Neat thanks for the heads up.
>
> On 10/14/06, Dibya Prakash <prakash.dibya@gmail.com> wrote:
> > Hi All,
> >
> > This is to let you know that my good friend, Satish Talim has put together
> > an excellent site – Learning Ruby here –
> > http://sitekreator.com/satishtalim/...
> >
> > This is based on his Ruby study notes made while he studied Ruby himself,
> > from various online Ruby resources like tutorials, blogs and Ruby
> > documentation. A site I would definitely recommend for Ruby newbies.
> >
> > Thanks
> > Dibya Prakash
> >
> >
>

Kevin Olemoh

10/14/2006 3:40:00 AM

0

I see thanks for the info.

On 10/14/06, Daniel N <has.sox@gmail.com> wrote:
> On 10/14/06, Kevin Olemoh <darkintent@gmail.com> wrote:
> >
> > One quick question in one of his examples he states that using single
> > quotes for strings is more efficient, why is this?
> >
> >
> I believe the theory goes that using single quotes means that there is no
> interperlation required, and therefore less work for the interpereter. Thus
> faster.
>
> This was discussed here a few of weeks ago, with some benchmarks that seemed
> to indicate that there
> really isn't much difference between the two.
>
> I'm not sure that the thread ended up reaching a conclusion though.
>
>

Devin Mullins

10/15/2006 1:42:00 AM

0

Daniel N wrote:
> I'm not sure that the thread ended up reaching a conclusion though.

No, it didn't. The hypothesis was that the *parser* has a little easier
time with non-interpolated strings, and the benchmarks didn't test that.
They had N.times { "blah blah" } when they should have had N.times {
eval '"blah blah"' }.

That said, it's hardly a reason to go for single quotes. I mean, the
quintessence of premature optimization dude. /That/ said, I think the
singles make less line noise.

Devin

Rick DeNatale

10/15/2006 1:58:00 AM

0

On 10/14/06, Devin Mullins <twifkak@comcast.net> wrote:
> Daniel N wrote:
> > I'm not sure that the thread ended up reaching a conclusion though.
>
> No, it didn't. The hypothesis was that the *parser* has a little easier
> time with non-interpolated strings, and the benchmarks didn't test that.
> They had N.times { "blah blah" } when they should have had N.times {
> eval '"blah blah"' }.
>
> That said, it's hardly a reason to go for single quotes. I mean, the
> quintessence of premature optimization dude. /That/ said, I think the
> singles make less line noise.

Yes, the reason for single over double quotes isn't about performance.

Personally, I try (or at least tend) to use single quotes unless I
need something which they don't give me like interpolation and escaped
characters.

--
Rick DeNatale

My blog on Ruby
http://talklikeaduck.denh...

James Gray

10/15/2006 4:30:00 AM

0

On Oct 14, 2006, at 8:41 PM, Devin Mullins wrote:

> Daniel N wrote:
> > I'm not sure that the thread ended up reaching a conclusion though.
>
> No, it didn't. The hypothesis was that the *parser* has a little
> easier time with non-interpolated strings, and the benchmarks
> didn't test that. They had N.times { "blah blah" } when they should
> have had N.times { eval '"blah blah"' }.

We did that too:

http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-t...

James Edward Gray II

Hal E. Fulton

10/15/2006 2:22:00 PM

0

Devin Mullins wrote:
> Daniel N wrote:
> > I'm not sure that the thread ended up reaching a conclusion though.
>
> No, it didn't. The hypothesis was that the *parser* has a little easier
> time with non-interpolated strings, and the benchmarks didn't test that.
> They had N.times { "blah blah" } when they should have had N.times {
> eval '"blah blah"' }.
>
> That said, it's hardly a reason to go for single quotes. I mean, the
> quintessence of premature optimization dude. /That/ said, I think the
> singles make less line noise.

A common convention is to use single quotes unless there is
a reason to use double quotes. I sometimes follow that, but
frequently forget.

I find the double quotes more intuitive, but it's a microscopic
difference and probably has to do with my years of C and BASIC
(notwithstanding the years of Pascal and Fortran).


Hal

David Vallner

10/15/2006 4:06:00 PM

0

Hal Fulton wrote:
> I find the double quotes more intuitive, but it's a microscopic
> difference and probably has to do with my years of C and BASIC
> (notwithstanding the years of Pascal and Fortran).
>

Seconded. Though recently, my fingers protest against my Java day job
where double-quotes are the only thing I hit Shift for. (I make heavy,
heavy abuse of autocomplete.)

David Vallner

Luther Luke

5/24/2007 11:11:00 AM

0

I am developing a Ruby tutorial as well. I will be covering CGI
integration and database programming too. I will also try ti hit web
caching and cookies for web programmers.

http://www.meshplex.org/wiki/Ruby/Ruby_on_Rails_programming...

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

Karl von Laudermann

5/24/2007 1:02:00 PM

0

On Oct 15 2006, 12:06 pm, David Vallner <d...@vallner.net> wrote:
> Seconded. Though recently, my fingers protest against my Java day job
> where double-quotes are the only thing I hit Shift for. (I make heavy,
> heavy abuse of autocomplete.)

Seriously? What about common operators like "+", "*", "&&", and "||"?
I don't see how autocomplete would help with those.