Eliot Miranda wrote:
Thanks Eliot. I found success with "World systemWindows select: [ :sw | sw model = Transcript]" However I'd like it used like "Transcript ensureOpen" and since "Transcript" is a global singleton holding an instance of ThreadSafeTranscript, I need something on the instance side. Though I'm not sure if I should only implement it on the instance-side, or if the instance-side should forward to it implemented on the class-side. Probably the latter. Since no instance variables are referenced it belongs on the class-side and the the instance-side is just for convenience. Second allInstances should never be used to search when a collection to search already exists; allInstances/allObjects does not scale. It's a great facility, but like others (eg doesNotUnderstand:) it can be abused :-). Point taken. Consider it was a first pass concept to show intent and generate the feedback I needed to do it properly ;) cheers -ben So just search the morphs from World. eg it is always quicker (and scales much better) to search the class hierarchy looking for methods than doing allInstances. Also using allInstances is akin to using isKindOf: and so is destroying or depending on the absence of polymorphism.Another alternative is to search the dependents of Transcript looking for an open SystemWindow and if you don't find one or the one you find is closed, open anew. You should find code like this for opening a new Monticello browser or raising the existing one etc. this pattern happens often enough. There are recent new examples in Squeak (Chris Muller's modifications to browsing senders/implementors which raises existing windows if available instead of always creating new ones; v nice). HTHX Eliot (phone) On Sep 20, 2014, at 8:57 AM, Ben Coman <[email protected]> wrote: |
- [Pharo-dev] proposed ThreadSafeTranscript>>ensureOpen Ben Coman
- Re: [Pharo-dev] proposed ThreadSafeTranscript>>en... Eliot Miranda
- Re: [Pharo-dev] proposed ThreadSafeTranscript>&g... Ben Coman
- Re: [Pharo-dev] proposed ThreadSafeTranscript>>en... Eliot Miranda
