> The difficulty I am having is that when I want to query the UserManager db 
> with something like:
> 
> ---
> RcIdentityBag(users) select: [ :each | each name := 'somename' ]
> —

Not sure if it’s just a typo, but it appears you’re trying to use assignment ( 
:= ) rather than comparison ( = ) so shouldn’t this be:

select: [ :each | each name = 'somename' ]

> It seems that currently the only I know how to do this is to create a select: 
> method in UserManager simply to pass the desired search string into the 
> UserManager class such that I can use the Collection Classes api to do the 
> actual work, as per:
> 
> --- Pardon the not so smalltalky code ---
> UserManager>>select: aString
>               | resultSet |
>               resultSet := users select: [ :each | each name := aString ].
>               ^resultSet
> ---
> 
> I believe I read somewhere that in order to avoid this clunkiness that I 
> could refer to the users collection in UserManager via a symbol and access 
> the api of the identitySet directly.  Something like:
> 
> ---
> UserManager class>>current
> 
>                                               
>       UserGlobals at: #FOO put users.
>       ...
> ---
> 
> But when I do this I am unable to do something like:
> 
> ---
> #FOO add: user
> ---

This isn’t really necessary - it’s totally up to your application design. The 
singleton will work fine.

> Finally Questions:
> 
> 1. Am I totally off the mark with the use of smalltalk symbols?
> 2. Must I create the API in the managing class to perform the specific 
> functions I need from the collection API with respect to querying the 
> collection?
> 3. Is there a smalltalk way of doing this properly that I missed (reading all 
> the docs I can find in random order based of info I need - probably missing 
> the finer points)?
> 
> Any nudge in the correct direction would be greatly appreciated.

It all looks good, apart from the select block.

Cheers


Reply via email to