From: "Mauricio Fernández" Date: 2003-03-26T18:29:16+09:00 Subject: Re: [EG] multiton design pattern On Wed, Mar 26, 2003 at 08:25:06AM +0900, ara howard wrote: > i did this so many times i decided to put it in one place. i've found > it to be more usefull that true singletons - which it can still be > used as. Is 'multiton' a standard term? By looking at the code, I'd say it corresponds mostly to GoF's Flyweight pattern (or rather to a specific instance of it :-) I've found one reference that backs my impression up: [ruby-list:21671] GoF's Flyweight Pattern http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-list/21671 > # a = SomeMultitonClass.instance(4) > # b = SomeMultitonClass.instance(4) # a and b are same object > # c = SomeMultitonClass.instance(2) # c is a different object > # > # print([a.arg,b.arg].max, c.arg, "\n") > # > # a = SomeMultitonClass.new # error (`new' is private) > Convenient and thread-safe! Neat! -- _ _ | |__ __ _| |_ ___ _ __ ___ __ _ _ __ | '_ \ / _` | __/ __| '_ ` _ \ / _` | '_ \ | |_) | (_| | |_\__ \ | | | | | (_| | | | | |_.__/ \__,_|\__|___/_| |_| |_|\__,_|_| |_| Running Debian GNU/Linux Sid (unstable) batsman dot geo at yahoo dot com Actually, typing random strings in the Finder does the equivalent of filename completion. -- Discussion on file completion vs. the Mac Finder