Interesting idea! Throw in operator overloading to retain the current make and its signature and the new make with addition of factory arg?
On Sunday, 27 August 2017 11:38:47 UTC-7, RogerV 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 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.