From: Phlip Date: 2008-10-13T19:42:14+09:00 Subject: Re: Procedure vs method Martin DeMello wrote: >> IMHO it makes sense to not refer to Procs as "procedures" because they >> actually are _closures_. This is a significant difference. > > For the original poster, here's a quick illustration: For the Ruby authors, here's an upgrade: > a = 42 > bar = Proc.new { puts a } You can store 'bar' & use it later, and it stores its link to 'a'. An important goal of encapsulation is to give everything the narrowest scope possible. Without closure, if we need 'a' to have a lifespan as long as 'bar', we have to make 'a' into a data member. That widens 'a's scope. With closures, 'a' has the narrowest scope possible over a long lifespan. That is a major win - and it's why platforms without closures don't know what they are missing! -- Phlip