On 24. 7. 2019 17:30, sergio ruiz wrote:
hmm???

maybe this is cleaner..

tracks
tracks ifNil: [ self tracks: OrderedCollection new ].
^ tracks

IMO, return ifNil: value is an understood and used idiom, so I'd say

  ^ tracks ifNil: [ tracks := ... ]

is the most clean way. Maybe look at sender of ifNil: and see for yourself which is the most idiomatic way to do lazy getter in the current image (there will be lots of these usages there).

Herby


because your #tracks: returns self, not the collection value

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

Public Key: http://bit.ly/29z9fG0
#BitMessage BM-NBaswViL21xqgg9STRJjaJaUoyiNe2dV
http://www.codeandmusic.com
http://www.twitter.com/sergio_101
http://www.facebook.com/sergio101



Reply via email to