On Thursday, 24 December 2020 at 10:23:09 UTC, Dmitriy Asondo wrote:
Hi!

I'm trying to check some js-like features. For example, if I want to store somewhere in array|tuple a list of pointers to classes (app services) how may I do that?

Hi, it seems that what you're looking for is Prototype Inheritance, which is not quite common among staticly typed programming languages due to its runtime nature.

Please note that the way you've implemented it in JavaScript doesn't take compile-time class constructors into consideration. Just look at how you're passing constructor parameters to your objects. In D, each class may have its own constructor, so the arguments may be totally different.

Also, it looks like you're trying to implement some kind of a Service Locator.

Could you tell what are you trying to achieve with this code? Are the arguments and the array index received at runtime?

Reply via email to