[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Re: Yield should be renamed call_block

Yukihiro Matsumoto

7/9/2007 12:58:00 AM

Hi,

In message "Re: Yield should be renamed call_block"
on Mon, 9 Jul 2007 09:10:23 +0900, Bharat Ruparel <bruparel@mercury.com> writes:

|I find it fascinating and quite a bit true. However, I have to always
|mentally translate the keyword "yeild" to mean "call_block".

The "yield" keyword is used for this purpose from the ages of
languages for example in CLU. So if you learn the history and the
culture, you will find less problem.

I am not going to rename it. But in far future (3.0? maybe), the
keyword will be removed from the language, and you will access blocks
via block arguments of methods.

matz.

13 Answers

John Joyce

7/9/2007 3:44:00 AM

0


On Jul 8, 2007, at 7:58 PM, Yukihiro Matsumoto wrote:

> Hi,
>
> In message "Re: Yield should be renamed call_block"
> on Mon, 9 Jul 2007 09:10:23 +0900, Bharat Ruparel
> <bruparel@mercury.com> writes:
>
> |I find it fascinating and quite a bit true. However, I have to
> always
> |mentally translate the keyword "yeild" to mean "call_block".
>
> The "yield" keyword is used for this purpose from the ages of
> languages for example in CLU. So if you learn the history and the
> culture, you will find less problem.
>
> I am not going to rename it. But in far future (3.0? maybe), the
> keyword will be removed from the language, and you will access blocks
> via block arguments of methods.
>
> matz.
>
to the OP, Of course with your won individual modules/libraries
loaded/required, you can alias yield to be whatever isn't already
taken by something else. Ideas for aliases: yield_to, call_block,
step_out, segway, divert, fork, short_fork, lunch_break, junk_time,
call_junk, goto ((hehehe...))

John Joyce

Chad Perrin

7/9/2007 5:39:00 AM

0

On Mon, Jul 09, 2007 at 09:58:23AM +0900, Yukihiro Matsumoto wrote:
> Hi,
>
> In message "Re: Yield should be renamed call_block"
> on Mon, 9 Jul 2007 09:10:23 +0900, Bharat Ruparel <bruparel@mercury.com> writes:
>
> |I find it fascinating and quite a bit true. However, I have to always
> |mentally translate the keyword "yeild" to mean "call_block".
>
> The "yield" keyword is used for this purpose from the ages of
> languages for example in CLU. So if you learn the history and the
> culture, you will find less problem.
>
> I am not going to rename it. But in far future (3.0? maybe), the
> keyword will be removed from the language, and you will access blocks
> via block arguments of methods.

That sounds pretty good -- and more consistent across the language, too.

--
CCD CopyWrite Chad Perrin [ http://ccd.ap... ]
Isaac Asimov: "Part of the inhumanity of the computer is that, once it is
completely programmed and working smoothly, it is completely honest."

Chad Perrin

7/9/2007 5:41:00 AM

0

On Mon, Jul 09, 2007 at 12:43:57PM +0900, John Joyce wrote:
>
> On Jul 8, 2007, at 7:58 PM, Yukihiro Matsumoto wrote:
>
> >Hi,
> >
> >In message "Re: Yield should be renamed call_block"
> > on Mon, 9 Jul 2007 09:10:23 +0900, Bharat Ruparel
> ><bruparel@mercury.com> writes:
> >
> >|I find it fascinating and quite a bit true. However, I have to
> >always
> >|mentally translate the keyword "yeild" to mean "call_block".
> >
> >The "yield" keyword is used for this purpose from the ages of
> >languages for example in CLU. So if you learn the history and the
> >culture, you will find less problem.
> >
> >I am not going to rename it. But in far future (3.0? maybe), the
> >keyword will be removed from the language, and you will access blocks
> >via block arguments of methods.
> >
> > matz.
> >
> to the OP, Of course with your won individual modules/libraries
> loaded/required, you can alias yield to be whatever isn't already
> taken by something else. Ideas for aliases: yield_to, call_block,
> step_out, segway, divert, fork, short_fork, lunch_break, junk_time,
> call_junk, goto ((hehehe...))

s/segway/segue/

. . unless those scooter things are what you had in mind in the first
place.

--
CCD CopyWrite Chad Perrin [ http://ccd.ap... ]
Baltasar Gracian: "A wise man gets more from his enemies than a fool from
his friends."

Charles Oliver Nutter

7/9/2007 8:29:00 AM

0

John Joyce wrote:
> to the OP, Of course with your won individual modules/libraries
> loaded/required, you can alias yield to be whatever isn't already taken
> by something else. Ideas for aliases: yield_to, call_block, step_out,
> segway, divert, fork, short_fork, lunch_break, junk_time, call_junk,
> goto ((hehehe...))

yield is a keyword. It can't be renamed or aliased.

- Charlie

Bertram Scharpf

7/9/2007 9:18:00 AM

0

Hi,

Am Montag, 09. Jul 2007, 14:39:15 +0900 schrieb Chad Perrin:
> On Mon, Jul 09, 2007 at 09:58:23AM +0900, Yukihiro Matsumoto wrote:
> > In message "Re: Yield should be renamed call_block"
> > on Mon, 9 Jul 2007 09:10:23 +0900, Bharat Ruparel <bruparel@mercury.com> writes:
> >
> > |I find it fascinating and quite a bit true. However, I have to always
> > |mentally translate the keyword "yeild" to mean "call_block".
> >
> > The "yield" keyword is used for this purpose from the ages of
> > languages for example in CLU. So if you learn the history and the
> > culture, you will find less problem.
> >
> > I am not going to rename it. But in far future (3.0? maybe), the
> > keyword will be removed from the language, and you will access blocks
> > via block arguments of methods.
>
> That sounds pretty good -- and more consistent across the language, too.

It would mess up my whole code when I had to mention the bock
parameter every time it's obvious there is one.

None of my methods is longer than 40 lines and this is a
habit I rely on every day. Pleeeease don't remove the yield
mechanism!

Bertram


--
Bertram Scharpf
Stuttgart, Deutschland/Germany
http://www.bertram-...

dblack

7/9/2007 10:17:00 AM

0

James Gray

7/9/2007 1:36:00 PM

0

On Jul 9, 2007, at 8:29 AM, John Joyce wrote:

>
> On Jul 9, 2007, at 3:29 AM, Charles Oliver Nutter wrote:
>
>> John Joyce wrote:
>>> to the OP, Of course with your won individual modules/libraries
>>> loaded/required, you can alias yield to be whatever isn't already
>>> taken by something else. Ideas for aliases: yield_to, call_block,
>>> step_out, segway, divert, fork, short_fork, lunch_break,
>>> junk_time, call_junk, goto ((hehehe...))
>>
>> yield is a keyword. It can't be renamed or aliased.
>>
> There is always (usually) a way to wrap something in a method. You
> can always make something def

I believe this is one of the exceptions. That's exactly why it is a
keyword.

Give it a shot.

James Edward Gray II

Bharat Ruparel

7/9/2007 3:00:00 PM

0

Yukihiro Matsumoto wrote:
>
> The "yield" keyword is used for this purpose from the ages of
> languages for example in CLU. So if you learn the history and the
> culture, you will find less problem.
>
> I am not going to rename it. But in far future (3.0? maybe), the
> keyword will be removed from the language, and you will access blocks
> via block arguments of methods.
>
> matz.

Hello Matz,
Before I say anything, I want to congratulate you for designing
something as elegant as Ruby. I think that DHH, you, and a whole lot of
other people have started something that can fundamentally change the
way IT functions IF handled with a bit of foresight, and off course,
luck. Thanks to you and DHH, programming is fun again.

Here is a question and feedback based on your responses and everyone
else's (equally appreciated):

1. I have to plead ignorance. I do not know the language history very
well. What is CLU?

2. I think that moving "yeild" to a method call is a great idea. That
way it can be freely aliased as and when needed. Why are you saying
that it will be done that far out (3.0?). Are you concerned about
"breaking" existing code? Educate me.

Thanks.

Bharat

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

Simen

7/9/2007 3:44:00 PM

0

On 7/9/07, Bharat Ruparel <bruparel@mercury.com> wrote:
> 2. I think that moving "yeild" to a method call is a great idea. That
> way it can be freely aliased as and when needed. Why are you saying
> that it will be done that far out (3.0?). Are you concerned about
> "breaking" existing code? Educate me.
>
> Thanks.
>
> Bharat
>
> --
> Posted via http://www.ruby-....
>
>

I think that in general, stuff that relies on implementation details
such as yield (you must lookup the block in the current scope) is a
language feature, and should be treated as such. The alternative would
be if Ruby provided a cross-platform interface to the interpreter, but
I don't see that happening anytime soon.

Also, aliasing "yield" would lead to confusion. I think it's good to
enforce consistency in this case.

--
- Simen

Charles Oliver Nutter

7/9/2007 3:57:00 PM

0

James Edward Gray II wrote:
> On Jul 9, 2007, at 8:29 AM, John Joyce wrote:
>> There is always (usually) a way to wrap something in a method. You can
>> always make something def
>
> I believe this is one of the exceptions. That's exactly why it is a
> keyword.
>
> Give it a shot.

Yes, I should have been more clear.

yield is a keyword whose function depends on having access to the
current call frame. Since any method you might define and call would
execute in a new call frame, there's no way to provide a method that
does what yield does. This is why if you ever want to pass a given block
to another method, you must capture it in a block argument, and also why
yielding to a block is much faster than calling a proc (since there's
less overhead in yielding than in calling a free-standing proc).

- Charlie