Local variables & blocks

>Hmm. ISTM that if this is a problem, it will affect Matz's [63100] as well.

No. Unlike yours, mine still has sort of block local variabls.

Well, you said that the block parameters would be local, shadowing if
necessary. But you also said there would be no other block local variables.

So what Guy made me think about was:

  Thread.new do
    i = 0
    .. is 'i' local to this thread, or is it shared between them?
  end

Regards,

Brian.

Well, you said that the block parameters would be local, shadowing if
necessary. But you also said there would be no other block local variables.

See [ruby-talk:63199] http://www.ruby-talk.org/63199

#local can be implemented as

   def local
      yield
   end

  Thread.new do
    i = 0
    .. is 'i' local to this thread, or is it shared between them?
  end

Actually local to the thread, with the proposition shared.

Guy Decoux

Hi,

···

In message “Re: Local variables & blocks” on 03/02/02, Brian Candler B.Candler@pobox.com writes:

Hmm. ISTM that if this is a problem, it will affect Matz’s [63100] as well.

No. Unlike yours, mine still has sort of block local variabls.

Well, you said that the block parameters would be local, shadowing if
necessary. But you also said there would be no other block local variables.

Block parameters are only way to create block local variables, but
they still exists. If I read right, there’s no block local variables
including block parameters in your proposal, right?

						matz.

Hi,

···

In message “Re: Local variables & blocks” on 03/02/03, ts decoux@moulon.inra.fr writes:

Thread.new do
i = 0
… is ‘i’ local to this thread, or is it shared between them?
end

Actually local to the thread, with the proposition shared.

In the current behavior. ‘i’ will not be block local, so that it will
be shared in my proposal.

						matz.

i like all of your plan except this. i’m not a brilliant programmer, but
nor am a stupid one, and that seems like it would take something that always
seems to end up being harder than it ought (threaded progamming) and makes it
harder. the fact that anything i create end up in my parent and siblings
seems difficult to grasp and coordinate for mere mortal programmers like
myself.

-a

···

On Mon, 3 Feb 2003, Yukihiro Matsumoto wrote:

In the current behavior. ‘i’ will not be block local, so that it will be
shared in my proposal.

====================================

Ara Howard
NOAA Forecast Systems Laboratory
Information and Technology Services
Data Systems Group
R/FST 325 Broadway
Boulder, CO 80305-3328
Email: ahoward@fsl.noaa.gov
Phone: 303-497-7238
Fax: 303-497-7259
====================================

This is one of the cases where I really want to be able to create
locals.

Having to do
def local
yield
end

Thread.new do
local do |i|
i = 0
end
end

is nothing but a declaration in disguise, and a very wordy one indeed.

···

On Mon, Feb 03, 2003 at 12:12:01AM +0900, Yukihiro Matsumoto wrote:

Hi,

In message “Re: Local variables & blocks” > on 03/02/03, ts decoux@moulon.inra.fr writes:

Thread.new do
i = 0
… is ‘i’ local to this thread, or is it shared between them?
end

Actually local to the thread, with the proposition shared.

In the current behavior. ‘i’ will not be block local, so that it will
be shared in my proposal.


_ _

__ __ | | ___ _ __ ___ __ _ _ __
'_ \ / | __/ __| '_ _ \ / ` | ’ \
) | (| | |
__ \ | | | | | (| | | | |
.__/ _,
|_|/| || ||_,|| |_|
Running Debian GNU/Linux Sid (unstable)
batsman dot geo at yahoo dot com

MS-DOS, you can’t live with it, you can live without it.
– from Lars Wirzenius’ .sig

Hi,

···

In message “Re: Local variables & blocks” on 03/02/03, ahoward ahoward@fsl.noaa.gov writes:

On Mon, 3 Feb 2003, Yukihiro Matsumoto wrote:

In the current behavior. ‘i’ will not be block local, so that it will be
shared in my proposal.

i like all of your plan except this. i’m not a brilliant programmer, but
nor am a stupid one, and that seems like it would take something that always
seems to end up being harder than it ought (threaded progamming) and makes it
harder. the fact that anything i create end up in my parent and siblings
seems difficult to grasp and coordinate for mere mortal programmers like
myself.

Hmm, so what is better behavior do you think? I think explicit block
local variables (using block parameters) work OK for threads too.

						matz.