On Thursday, February 15, 2018 23:22:17 Adam D. Ruppe via Digitalmars-d- learn wrote: > On Thursday, 15 February 2018 at 23:20:42 UTC, Jonathan M Davis > > wrote: > > The only overloaded operator that I'd expect to work as static > > would be opCall, which I expect works primarily because of > > functors but is useful for factory functions as well. > > static opCall is kinda weird in practice and frequently conflicts > with non-static opCall as well as constructors. I don't suggest > anyone try to use it (and in fact, I'd like to have it removed > from the language)
If you use static opCall, then you don't use constructors, and you don't use a non-static opCall. There are times where that makes perfect sense, and plenty of times when it doesn't. Personally, it's what I use when I need a factory function or in the rare case where I have a singleton (e.g. std.datete.timezone's UTC and LocalTime are both singletons that use static opCall to get at their single instance). It wouldn't surprise me if folks trying to avoid the GC used static opCall to create functors instead of using lambdas, but I don't recall ever doing that personally. So, I like having static opCall and use it periodically, and as such, I'd hate to see it removed from the language, but it is true that its use is somewhat limited. - Jonathan M Davis