[Borges-users] controller and delegate

Eric Hodel drbrain at segment7.net
Sun Apr 25 15:58:26 EDT 2004


??????? ???????? (slepnev_v at rambler.ru) wrote:

> >I'm not 100% sure a refresh rebuilds a page, since you end up with the
> >same action id.  But then how does the cart get updated?  Very 
> >puzzling.
> 
> Well, on my machine, a refresh does rebuild the page =) at least the 
> URLs in action links change.

Yeah... puzzling.  There's much I still don't understand.

> >I think alot of the memory consumption is due to Ruby's greedy closures.
> >Using foo_on(meth, obj) rather than foo do ... end will help keep memory
> >usage down.
> 
> I don't understand. You're going to wrap methods in Proc objects? 
> They're closures.

They're "smaller" closures.  For example:

def my_meth
  x = UnusedObject.new
  y = UsedObject.new
  return proc do y.foo end
end

The proc returned from my_meth will keep UnusedObject around until
the proc is garbage collected.

def make_proc(obj)
  return proc do obj.foo end
end

def my_meth
  x = UnusedObject.new
  y = UsedObject.new

  return make_proc y
end

Here, the proc returned from my_meth only references UsedObject, so
UnusedObject can be garbage collected since what is in scope has been
limited.

-- 
Eric Hodel - drbrain at segment7.net - http://segment7.net
All messages signed with fingerprint:
FEC2 57F1 D465 EB15 5D6E  7C11 332A 551C 796C 9F04

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/borges-users/attachments/20040425/4fd4a75e/attachment.bin


More information about the Borges-users mailing list