[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Yield should be renamed call_block

Bharat Ruparel

7/9/2007 12:10:00 AM

One of the virtues of the Ruby language that is touted by just about
everyone including the language designer Matz is that it is supposedly
very intuitive, follows principle of least surprise, duck typing and on
and on.
I find it fascinating and quite a bit true. However, I have to always
mentally translate the keyword "yeild" to mean "call_block". I find
that it is the biggest distraction that I have when I am trying to
figure out what and how a a method with a block and calling code
interact. I can understand all that baggage such as "lambda" function
name from Lisp and the wonderful "$" variables that came from Perl, but
where did the keyword yeild come from? And why has not anyone aske Matz
to consider changing it to infinitely more obvious "call_block"? It it
that big a deal? In an open source language?

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

5 Answers

SonOfLilit

7/9/2007 12:17:00 AM

0

I find that "yield" describes what the method does even better than
"call_block".

Besides, there is a principle in ruby's design of having the most used
methods be shorter.

It's important because thinking "this function then yields" is far
more consise than thinking "this function then calls call_block".


POLS, btw, is defined as "POLS to Matz", and there is much emphasis on that.


Aur

On 7/9/07, Bharat Ruparel <bruparel@mercury.com> wrote:
> One of the virtues of the Ruby language that is touted by just about
> everyone including the language designer Matz is that it is supposedly
> very intuitive, follows principle of least surprise, duck typing and on
> and on.
> I find it fascinating and quite a bit true. However, I have to always
> mentally translate the keyword "yeild" to mean "call_block". I find
> that it is the biggest distraction that I have when I am trying to
> figure out what and how a a method with a block and calling code
> interact. I can understand all that baggage such as "lambda" function
> name from Lisp and the wonderful "$" variables that came from Perl, but
> where did the keyword yeild come from? And why has not anyone aske Matz
> to consider changing it to infinitely more obvious "call_block"? It it
> that big a deal? In an open source language?
>
> --
> Posted via http://www.ruby-....
>
>

Simen

7/9/2007 12:29:00 AM

0

On 7/9/07, Bharat Ruparel <bruparel@mercury.com> wrote:
> One of the virtues of the Ruby language that is touted by just about
> everyone including the language designer Matz is that it is supposedly
> very intuitive, follows principle of least surprise, duck typing and on
> and on.
> I find it fascinating and quite a bit true. However, I have to always
> mentally translate the keyword "yeild" to mean "call_block". I find
> that it is the biggest distraction that I have when I am trying to
> figure out what and how a a method with a block and calling code
> interact. I can understand all that baggage such as "lambda" function
> name from Lisp and the wonderful "$" variables that came from Perl, but
> where did the keyword yeild come from?

Intuivitely, a function yields its hold of the Vm/interpreter to its
caller. "Yield" is also used in some cooperative-threading
implementations, in which a thread yields control to the scheduler. I
don't think the name is unintuitive at all. Besides, keywords should
be short, conscise, and why in the name of the Language Designer gods
should there be an underscore in a keyword?!

And why has not anyone aske Matz
> to consider changing it to infinitely more obvious "call_block"? It it
> that big a deal? In an open source language?
>

No, it's not. You're free to change the language so that "yield"
becomes "call_block" and release your own version. I don't think it
requires much tweaking. But I guess you'll be the only user, so why
bother?

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


--
- Simen

Simen

7/9/2007 12:32:00 AM

0

On 7/9/07, Simen Edvardsen <toalett@gmail.com> wrote:
> On 7/9/07, Bharat Ruparel <bruparel@mercury.com> wrote:
> > One of the virtues of the Ruby language that is touted by just about
> > everyone including the language designer Matz is that it is supposedly
> > very intuitive, follows principle of least surprise, duck typing and on
> > and on.
> > I find it fascinating and quite a bit true. However, I have to always
> > mentally translate the keyword "yeild" to mean "call_block". I find
> > that it is the biggest distraction that I have when I am trying to
> > figure out what and how a a method with a block and calling code
> > interact. I can understand all that baggage such as "lambda" function
> > name from Lisp and the wonderful "$" variables that came from Perl, but
> > where did the keyword yeild come from?
>
> Intuivitely, a function yields its hold of the Vm/interpreter to its
> caller. "Yield" is also used in some cooperative-threading
> implementations, in which a thread yields control to the scheduler. I
> don't think the name is unintuitive at all. Besides, keywords should
> be short, conscise, and why in the name of the Language Designer gods
> should there be an underscore in a keyword?!
>
> And why has not anyone aske Matz
> > to consider changing it to infinitely more obvious "call_block"? It it
> > that big a deal? In an open source language?
> >
>
> No, it's not. You're free to change the language so that "yield"
> becomes "call_block" and release your own version. I don't think it
> requires much tweaking. But I guess you'll be the only user, so why
> bother?
>
> > --
> > Posted via http://www.ruby-....
> >
> >
>
>
> --
> - Simen
>

"Intuivitely, a function yields its hold of the Vm/interpreter to its
caller." should be "Intuivitely, a function yields its hold of the
Vm/interpreter to its
block", of course.

--
- Simen

Chad Perrin

7/9/2007 5:38:00 AM

0

On Mon, Jul 09, 2007 at 09:32:26AM +0900, Simen Edvardsen wrote:
> >
> >Intuivitely, a function yields its hold of the Vm/interpreter to its
> >caller. "Yield" is also used in some cooperative-threading
> >implementations, in which a thread yields control to the scheduler. I
> >don't think the name is unintuitive at all. Besides, keywords should
> >be short, conscise, and why in the name of the Language Designer gods
> >should there be an underscore in a keyword?!
>
> "Intuivitely, a function yields its hold of the Vm/interpreter to its
> caller." should be "Intuivitely, a function yields its hold of the
> Vm/interpreter to its
> block", of course.

s/Intuivitely/Intuitively/

(as long as we're correcting stuff)

--
CCD CopyWrite Chad Perrin [ http://ccd.ap... ]
Dr. Ron Paul: "Liberty has meaning only if we still believe in it when
terrible things happen and a false government security blanket beckons."

Robert Dober

7/9/2007 11:45:00 AM

0

On 7/9/07, SonOfLilit <sonoflilit@gmail.com> wrote:
> I find that "yield" describes what the method does even better than
> "call_block".
>
> Besides, there is a principle in ruby's design of having the most used
> methods be shorter.
>
> It's important because thinking "this function then yields" is far
> more consise than thinking "this function then calls call_block".

Agree 100%
>
>
> POLS, btw, is defined as "POLS to Matz", and there is much emphasis on that.
Disagree a little bit, I have seen Matz telling so but I believe there
was a smiley attached.
Maybe one can say that Matz' POLS is slightly more important than the
community's POLS which is difficult to determine sometimes.

Why am I saying this? I have seen the "POLS is Matz' POLS" frequently
recently and I think the "real" POLS is indeed a great asset of Ruby
even or because it is so difficult to determine. It would be a pity to
lose this attitude.

It is of course clear that POLS for everyone is impossible :(


Cheers
Robert

--
I always knew that one day Smalltalk would replace Java.
I just didn't know it would be called Ruby
-- Kent Beck