Administrator
|
I've noticed we use a buffet of accessors for singletons, like #default, #instance, #current... it'd be nice to just pick one. I like #instance, but could live with any as long as I never have to guess which one from a list again :)
Sean
Cheers,
Sean |
To me, default and current suggest these are not singleton, and I
wouldn't be surprised to see a specific, previous and next instances. Nicolas 2012/5/14 Sean P. DeNigris <[hidden email]>: > I've noticed we use a buffet of accessors for singletons, like #default, > #instance, #current... it'd be nice to just pick one. I like #instance, but > could live with any as long as I never have to guess which one from a list > again :) > > Sean > > -- > View this message in context: http://forum.world.st/Singleton-access-selector-tp4630062.html > Sent from the Pharo Smalltalk mailing list archive at Nabble.com. > |
In reply to this post by Sean P. DeNigris
On Mon, May 14, 2012 at 6:24 AM, Sean P. DeNigris <[hidden email]> wrote: I've noticed we use a buffet of accessors for singletons, like #default, Indeed. For me it depends in the case. For the general case, I like #uniqueInstance. And #default and #current I use it when it is not completly singleton. I mean, when there is a class side variable storing it, but there could be also some other instances, like non-default or non-current.
-- Mariano http://marianopeck.wordpress.com |
On Mon, May 14, 2012 at 9:42 AM, Mariano Martinez Peck <[hidden email]> wrote:
+1
|
Historically, #soleInstance can be found in st80 I think.
Nicolas 2012/5/14 Esteban Lorenzano <[hidden email]>: > > > On Mon, May 14, 2012 at 9:42 AM, Mariano Martinez Peck > <[hidden email]> wrote: >> >> >> >> On Mon, May 14, 2012 at 6:24 AM, Sean P. DeNigris <[hidden email]> >> wrote: >>> >>> I've noticed we use a buffet of accessors for singletons, like #default, >>> #instance, #current... it'd be nice to just pick one. I like #instance, >>> but >>> could live with any as long as I never have to guess which one from a >>> list >>> again :) >> >> >> Indeed. For me it depends in the case. For the general case, I like >> #uniqueInstance. And #default and #current I use it when it is not completly >> singleton. I mean, when there is a class side variable storing it, but there >> could be also some other instances, like non-default or non-current. > > > +1 > >> >> >>> >>> >>> Sean >>> >>> -- >>> View this message in context: >>> http://forum.world.st/Singleton-access-selector-tp4630062.html >>> Sent from the Pharo Smalltalk mailing list archive at Nabble.com. >>> >> >> >> >> -- >> Mariano >> http://marianopeck.wordpress.com >> > |
For personal/work projects, I also use #uniqueInstance. It's true that if #current is used for singleton instances it could be ambiguous.
On Mon, May 14, 2012 at 7:12 AM, Nicolas Cellier <[hidden email]> wrote: Historically, #soleInstance can be found in st80 I think. |
Administrator
|
In reply to this post by Mariano Martinez Peck
Fair enough, but let's have a protocol. For example, UIManager default... From Mac dictionary: default: "a preselected option... when no alternative is specified by the user" Is that really what we mean? I don't think so. It should be current. SystemAnnouncer is a very special class. It gets two identically implemented methods, #announcer and #current ;-) So how about: uniqueInstance -> There can be only one (http://www.youtube.com/watch?v=4AoOa-Fz2kw) current -> There are many like it, but this one is mine (couldn't find the clip from Full Metal Jacket) default -> Use this if you don't have any better ideas
Cheers,
Sean |
On Mon, May 14, 2012 at 3:43 PM, Sean P. DeNigris <[hidden email]> wrote:
+1 -- |
Free forum by Nabble | Edit this page |