Re: How to store a pointer to class contructor

2020-12-25 Thread Jacob Carlborg via Digitalmars-d-learn
On Thursday, 24 December 2020 at 10:23:09 UTC, Dmitriy Asondo wrote: I expect code like this: -- class OloloService {} class BlablaService {} auto servicesList = [OloloService, BlablaService]; auto serviceInstance = new servicesList[1](args); -- Here's

Re: How to store a pointer to class contructor

2020-12-24 Thread Jacob Shtokolov via Digitalmars-d-learn
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

Re: How to store a pointer to class contructor

2020-12-24 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 24 December 2020 at 11:15:28 UTC, Dmitriy Asondo wrote: Is there any way, for example on compile step, to get class name from class pointer? To automate generation of factory via template At compile time, you'd get it from the type, not the reference: typeid(T).name;

Re: How to store a pointer to class contructor

2020-12-24 Thread Dmitriy Asondo via Digitalmars-d-learn
On Thursday, 24 December 2020 at 11:02:11 UTC, Mike Parker wrote: On Thursday, 24 December 2020 at 10:33:00 UTC, Dmitriy Asondo wrote: The idea is to store somewhere services (classes) first and only when the app need - instantiate services for app/thread/http-request (as option) and provide va

Re: How to store a pointer to class contructor

2020-12-24 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 24 December 2020 at 10:33:00 UTC, Dmitriy Asondo wrote: The idea is to store somewhere services (classes) first and only when the app need - instantiate services for app/thread/http-request (as option) and provide values to constructors via DI There's `Object.factory`, which cons

Re: How to store a pointer to class contructor

2020-12-24 Thread Dmitriy Asondo via Digitalmars-d-learn
The idea is to store somewhere services (classes) first and only when the app need - instantiate services for app/thread/http-request (as option) and provide values to constructors via DI

How to store a pointer to class contructor

2020-12-24 Thread Dmitriy Asondo via Digitalmars-d-learn
Hi! You may hate me, but currently I'm using nodejs. I want to use dlang as a second instrument and 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? I expect code like this: --