From: Simen Edvardsen Date: 2007-07-09T09:32:26+09:00 Subject: Re: Yield should be renamed call_block On 7/9/07, Simen Edvardsen wrote: > On 7/9/07, Bharat Ruparel 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-forum.com/. > > > > > > > -- > - 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