I don't really understand what you are suggesting, I think. On Sun, Aug 27, 2017 at 8:38 PM, RogerV <roger.dewa...@gmail.com> wrote:
> Would it be feasible for the built-in make() function to be enhanced to > also accept a factory signifier as an additional argument? The idea would > be that I could go and implement my own custom variations of map and slice Not sure I understand this suggestion. AIUI, you want to be able to do something like var s = make(map[A]B, MakeT) Where MakeT returns a value of some custom data type T (say an RB-Tree based map). I assume you then want to be able to use the returned value interchangeable with a map[A]B. Is this correct? If not, can you describe what you are suggesting differently? while using make() to instantiate instances of them to where the returned > object is fully initialized and ready for use per standard make() > semantics. I would also get the advantage of make() determining what types > are in the map or slice - some of the benefit of generics. > There would be a registration API to register a factory mechanism and > establish the factory signifier that is used in conjunction to the enhanced > make() function. > > Could it be one more modest measure to forestall adding full blown > generics but get a little bit of the benefit? > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.