poolDictionary access in a Workspace
Joshua 'Schwa' Gargus
schwa at cc.gatech.edu
Tue Sep 9 19:08:24 UTC 2003
Thanks Torge!
I'll give it a trywhenI get home this evening.
Joshua
On Tue, Sep 09, 2003 at 08:22:36PM +0200, Torge Husfeldt wrote:
> Hi Schwa,
>
> On Tue, 9 Sep 2003 01:27:49 -0400, Joshua 'Schwa' Gargus
> <schwa at cc.gatech.edu> wrote:
>
> >What do the rest of you do when you want to access values in
> >SharedPools from a Workspace? I have been adding the pools I'm
> >interested to UndefinedObject, but it feels like a hack.
> >
> >Poking around, it looks like we might let Workspace implement
> >#doItContext and #doItReceiver to return objects that will magically
> >result in the proper lookup when a workspace expression is compiled.
> >The more I think about this, it seems like an even worse hack; at
> >least the current one is simple.
> >
> >Then I thought about Workspace>>bindingOf:, but this doesn't even
> >get called if you type in a name beginning with a capital letter.
> Do you have any examples?
> I'd like to hack away on this one but the examples i came up with
> like #TextConstants are globals too, so they are found automatically.
> How does one find sharedPools that are not globals.
> ...goes hacking in squeak
> OK i got it.
> This doIt gave me 42(!) PoolDictionaries that are not Globals.
> | pools |
> {String streamContents:[:strm |
> pools _ Association allInstances.
> strm nextPutAll: pools size printString;cr.
> pools _ pools select:[:ass | ass key class == Symbol].
> strm nextPutAll: pools size printString;cr.
> pools _ pools select:[:ass | ass key first isUppercase].
> strm nextPutAll: pools size printString;cr.
> pools _ pools select:[:ass | (Smalltalk at: ass key ifAbsent:[true])
> == true].
> strm nextPutAll: pools size printString;cr.
> pools _ pools select:[:ass | ass value class == Dictionary].
> strm nextPutAll: pools size printString;cr].
> pools}
> ... and also the insight that it is the bindings inside the pool dicts
> you're after.
>
> >
> >Does anyone have any other ideas?
> >
> >Joshua
> >
> >
> I think the use of bindingOf: together with allowing the Parser to
> ask for the binding og an uppercase varname is the most
> straightforward hack.
> I included a menu action for workspaces that adds all bindings from
> a pool of the user's choice to it's internal bindings (one-way).
> HTH,
> Torge
>
> --
> Der Mensch kann wohl tun, was er will, aber er kann nicht wollen, was er
> will.
> (Schopenhauer)
>
More information about the Squeak-dev
mailing list
|