editing an instance variable in an OrderedCollection

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

editing an instance variable in an OrderedCollection

sergio_101-2
if i have an ordered collection of say albums...

and the albums have a 'desc' instance variable..

and i decide i want to change 'desc' from 'this is a bad album' to
'this is a good album' on the 7th element in the list, how would i
phrase that?

i am kicking around:

Album repository at: 7 desc: 'this is a good album'

but i don't think the evaluation order is correct..

any ideas?

thanks!

--

----
peace,
sergio
photographer, journalist, visionary

http://www.coffee-black.com
http://www.painlessfrugality.com
http://www.twitter.com/sergio_101
http://www.facebook.com/sergio101
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: editing an instance variable in an OrderedCollection

Matthias Berth-2
You just need to use parentheses, like so:

(Album repository at: 7) desc: 'this is a good album'

BTW, it is better to use full words for your method and variable names
-- they are much easier to guess.

I don't know about the context where you want to use this, but maybe
it is a good idea to separate it into two statements:

album := Album repository at: 7.
album description: 'this is a good album'.

Cheers

Matthias

On Sat, Mar 6, 2010 at 3:40 PM, sergio_101 <[hidden email]> wrote:

> if i have an ordered collection of say albums...
>
> and the albums have a 'desc' instance variable..
>
> and i decide i want to change 'desc' from 'this is a bad album' to
> 'this is a good album' on the 7th element in the list, how would i
> phrase that?
>
> i am kicking around:
>
> Album repository at: 7 desc: 'this is a good album'
>
> but i don't think the evaluation order is correct..
>
> any ideas?
>
> thanks!
>
> --
>
> ----
> peace,
> sergio
> photographer, journalist, visionary
>
> http://www.coffee-black.com
> http://www.painlessfrugality.com
> http://www.twitter.com/sergio_101
> http://www.facebook.com/sergio101
> _______________________________________________
> Beginners mailing list
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: editing an instance variable in an OrderedCollection

sergio_101-2
> BTW, it is better to use full words for your method and variable names
> -- they are much easier to guess.
>

yes.. i first used description, but i saw that it was overriding
another method, so i thought i might play it safe..


> I don't know about the context where you want to use this, but maybe
> it is a good idea to separate it into two statements:
>
> album := Album repository at: 7.
> album description: 'this is a good album'.
>

that was what i initially thought.. but i wasn't sure it it was saving
me anything by putting them together...

thanks!



--

----
peace,
sergio
photographer, journalist, visionary

http://www.coffee-black.com
http://www.painlessfrugality.com
http://www.twitter.com/sergio_101
http://www.facebook.com/sergio101
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners