--1926193751-1394353213-12186537247298
Content-Type: MULTIPART/MIXED; BOUNDARY="1926193751-1394353213-1218653724=:17298"

  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.

--1926193751-1394353213-12186537247298
Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed
Content-Transfer-Encoding: QUOTED-PRINTABLE

Hi --

On Thu, 14 Aug 2008, Iñaki Baz Castillo wrote:

> El Martes, 12 de Agosto de 2008, David A. Black escribió:
>> If you want to use a non-parameter inside a block and have it not
>> clobber an outside variable, you can declare it as a local variable by
>> putting it after a semi-colon in the parameter list:
>>
>>  {|x,y,z;a| a = 1 }  # a is not bound to any block args but is
>>             # local to the block
>
>
> Could I use that to avoid the problem if I do this:
>
>  Thread.new(request) { |request| ... }
>
> This is a big problem since the "request" into the block points to the request
> outside, so each thread share it (dangerous). This is why I use:
>
>  Thread.new(request) { |req| ... }
>
> Could I use this?
>  Thread.new(request) { |;request| ... }

No, because you then have no block parameter to which to bind the
thread object. Variables listed after the semi-colon are available as
local variables in the block, but do not participate in the argument
bindings.


David

-- 
Rails training from David A. Black and Ruby Power and Light:
  *  Advancing With Rails    August 18-21    Edison, NJ
  * Co-taught by D.A. Black and Erik Kastner
See http://www.rubypal.com for details and updates!
--1926193751-1394353213-12186537247298--
--1926193751-1394353213-12186537247298--