Vote UpVote

Great answer by Cosmin Prund: How and when are variables referenced in Delphi’s anonymous methods captured? – Stack Overflow

The Wiert Corner – Every once in a while, by accident you stumble on a really great answer on StackOverflow. Here is a quote from Cosmin Prund describing on how Delphi implements anonymous methods using a TInterfacedObject descendant: When you have a function like the one in the question, where you have an anonymous method accessing a local variable, Delphi appears to create one TInterfacedObject descendant that captures all the stack based variables as it’s own public variables. Using Barry’s trick to get to the implementing TObject and a bit of RTTI we can see this whole thing in action. Read his ...
Favorite? Off-Topic? jpluimers @ 2012-01-05 06:00


Visits: 851
Votes: 2
Favorites: 0
Off-Topic: 0

Visits by Source

User Actions

Users who voted for this posting

Contact us to advertise on DelphiFeeds.com

Community Links

Torry Firebird News


Please login or register to use this functionality.
(click on this box to dismiss)