On Tuesday, 12 November 2013 at 05:46:19 UTC, Andrei Alexandrescu wrote:
On 11/11/13 2:36 PM, Timon Gehr wrote:
On 11/11/2013 11:02 PM, deadalnix wrote:
On Sunday, 10 November 2013 at 12:39:35 UTC, Timon Gehr wrote:
What about Object.factory?

I always though of it as a misfeature.

Me too.

... well time to substantiate.

Andrei

OK, but first, it has to be noted that this is putting the burden of proof on the wrong side of the argument.

So I ran `grep -r * -e 'Object.factory'` on my d folder. I have various D project there. The only uses of Object.factory are the test suite of dmd, ldc and GDC.

I have bunch of D code in there, not simply mine. So first thing : it is unused. Secondly, the only useful things you can do with that require to upcast (and break basic OOP principle, which is kind of ironic for a feature that produce objects). The design of the feature is unsound.

It is not that surprising as different possible uses case are better solved with compile time reflection and metaprograming.

Implementationwise, this feature require to pull into the application some unoptimizable bloat. It is also a tedious constraint for shared objects as we see in this thread.

Reply via email to