DynamicBindings - how to get a snapshot

Derek Brans brans at nerdonawire.com
Fri Apr 25 18:56:22 UTC 2003


Here's what I came up with.

DynamicBindings>>snapshot
 "returns an identity dictionary with a flattened view of me to be saved for later"
 |dictionary tmp|
 dictionary _ IdentityDictionary new.
 tmp _ self.
 [tmp isNil not] whileTrue: [tmp keysAndValuesDo: [:k :v |
   dictionary at: k ifAbsentPut: v]. tmp _ tmp parent].
 ^ dictionary

Derek Brans
Nerd on a Wire
Web design that's anything but square
http://www.nerdonawire.com 
phone: 604.874.6463
mailto: brans at nerdonawire.com

  ----- Original Message ----- 
  From: Derek Brans 
  To: The general-purpose Squeak developers list 
  Sent: Friday, April 25, 2003 11:32 AM
  Subject: DynamicBindings - how to get a snapshot


  Hi Stephen,

  I don't know if this is poor programming practice, but I want to take a snapshot of the bindings in one context and store them as an instance variable, to be used in another context. 

  Doing that I can answer questions like: 
  Who was my parent component at rendering time?  Which component was named "containerA" at rendering time?

  Could you tell me if this is a misuse of DynamicBindings and if not, how to take a snapshot?

  Thank you,
  Derek

  Derek Brans
  Nerd on a Wire
  Web design that's anything but square
  http://www.nerdonawire.com 
  phone: 604.874.6463
  mailto: brans at nerdonawire.com



------------------------------------------------------------------------------



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20030425/32997f37/attachment.htm


More information about the Squeak-dev mailing list