Re: Pharo-users Digest, Vol 76, Issue 36

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
ian
Reply | Threaded
Open this post in threaded view
|

Re: Pharo-users Digest, Vol 76, Issue 36

ian
Thanks for your response.

Yes, type in the select block.

Thanks for letting me know I am on the right track...

On Sun, Aug 18, 2019 at 12:00:06PM -0400, [hidden email] wrote:

> Send Pharo-users mailing list submissions to
> [hidden email]
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://lists.pharo.org/mailman/listinfo/pharo-users_lists.pharo.org
> or, via email, send a message with subject or body 'help' to
> [hidden email]
>
> You can reach the person managing the list at
> [hidden email]
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Pharo-users digest..."
>
>
> Today's Topics:
>
>    1. Re: As a SmallTalk youngster: A few questions... (Jupiter Jones)
>    2. Re: As a SmallTalk youngster: A few questions... (Jupiter Jones)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Sun, 18 Aug 2019 09:09:39 +1000
> From: Jupiter Jones <[hidden email]>
> To: Any question about pharo is welcome <[hidden email]>
> Subject: Re: [Pharo-users] As a SmallTalk youngster: A few
> questions...
> Message-ID: <[hidden email]>
> Content-Type: text/plain; charset="utf-8"
>
> > 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
>
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <http://lists.pharo.org/pipermail/pharo-users_lists.pharo.org/attachments/20190818/a593a1eb/attachment-0001.html>
>
> ------------------------------
>
> Message: 2
> Date: Sun, 18 Aug 2019 09:11:56 +1000
> From: Jupiter Jones <[hidden email]>
> To: Any question about pharo is welcome <[hidden email]>
> Subject: Re: [Pharo-users] As a SmallTalk youngster: A few
> questions...
> Message-ID: <[hidden email]>
> Content-Type: text/plain; charset="us-ascii"
>
> Also if you add #FOO to UserGlobals you should be able to reference it like:
>
> FOO add: user
>
> ie. without the symbol hash (#)
>
> > On 17 Aug 2019, at 11:28 pm, ian <[hidden email]> wrote:
> >
> > ---
> > #FOO add: user
> > ---
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <http://lists.pharo.org/pipermail/pharo-users_lists.pharo.org/attachments/20190818/f19c36fb/attachment-0001.html>
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
> Pharo-users mailing list
> [hidden email]
> http://lists.pharo.org/mailman/listinfo/pharo-users_lists.pharo.org
>
>
> ------------------------------
>
> End of Pharo-users Digest, Vol 76, Issue 36
> *******************************************