[Pharo-project] Singleton access selector
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.
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 <sean@clipperadams.com>:
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.
On Mon, May 14, 2012 at 6:24 AM, Sean P. DeNigris <sean@clipperadams.com>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.
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
On Mon, May 14, 2012 at 9:42 AM, Mariano Martinez Peck < marianopeck@gmail.com> wrote:
On Mon, May 14, 2012 at 6:24 AM, Sean P. DeNigris <sean@clipperadams.com>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
Historically, #soleInstance can be found in st80 I think. Nicolas 2012/5/14 Esteban Lorenzano <estebanlm@gmail.com>:
On Mon, May 14, 2012 at 9:42 AM, Mariano Martinez Peck <marianopeck@gmail.com> wrote:
On Mon, May 14, 2012 at 6:24 AM, Sean P. DeNigris <sean@clipperadams.com> 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 < nicolas.cellier.aka.nice@gmail.com> wrote:
Historically, #soleInstance can be found in st80 I think.
Nicolas
2012/5/14 Esteban Lorenzano <estebanlm@gmail.com>:
On Mon, May 14, 2012 at 9:42 AM, Mariano Martinez Peck <marianopeck@gmail.com> wrote:
On Mon, May 14, 2012 at 6:24 AM, Sean P. DeNigris <
sean@clipperadams.com>
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
Mariano Martinez Peck wrote
Indeed. For me it depends in the case.
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 -- View this message in context: http://forum.world.st/Singleton-access-selector-tp4630062p4630137.html Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
On Mon, May 14, 2012 at 3:43 PM, Sean P. DeNigris <sean@clipperadams.com>wrote:
Mariano Martinez Peck wrote
Indeed. For me it depends in the case.
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
+1
-- View this message in context: http://forum.world.st/Singleton-access-selector-tp4630062p4630137.html Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
participants (5)
-
Carla F. Griggio -
Esteban Lorenzano -
Mariano Martinez Peck -
Nicolas Cellier -
Sean P. DeNigris