Re: Parsing a string to instantiate classes at runtime

2016-11-28 Thread Jacob Carlborg via Digitalmars-d-learn
On 2016-11-29 07:46, Marduk wrote: Aha! Interesting. Thanks. Then you can call a custom method that acts as a constructor when the instance is created this way, if there's a need for it. -- /Jacob Carlborg

Re: Parsing a string to instantiate classes at runtime

2016-11-28 Thread Marduk via Digitalmars-d-learn
On Monday, 28 November 2016 at 09:33:08 UTC, Jacob Carlborg wrote: It's possible to bypass the constructors [1]. [1] https://github.com/jacob-carlborg/orange/blob/master/orange/util/Reflection.d#L166 Aha! Interesting. Thanks.

Re: Parsing a string to instantiate classes at runtime

2016-11-28 Thread Marduk via Digitalmars-d-learn
On Sunday, 27 November 2016 at 21:28:52 UTC, ag0aep6g wrote: Ok, that's a hypothetical. It's "if D had a 'dynamic mixin', then we could do fancy things with it." D doesn't have a 'dynamic mixin', so you can't do those fancy things, at least not in the envisioned way. You are right. I misread

Re: Parsing a string to instantiate classes at runtime

2016-11-28 Thread Jacob Carlborg via Digitalmars-d-learn
On 2016-11-27 22:19, Marduk wrote: Sure, it's here: http://forum.dlang.org/post/xmnnsdiuwyjrhkasy...@forum.dlang.org In that thread they also mention Object.factory, but the documentation says that the class must have either no constructor or the default constructor, which is not my case. It'

Re: Parsing a string to instantiate classes at runtime

2016-11-27 Thread ag0aep6g via Digitalmars-d-learn
On 11/27/2016 10:19 PM, Marduk wrote: On Sunday, 27 November 2016 at 21:10:30 UTC, ag0aep6g wrote: Can you link that post, please? I can't imagine what "dynamic mixin" could refer to. Sure, it's here: http://forum.dlang.org/post/xmnnsdiuwyjrhkasy...@forum.dlang.org Ok, that's a hypothetical.

Re: Parsing a string to instantiate classes at runtime

2016-11-27 Thread Marduk via Digitalmars-d-learn
On Sunday, 27 November 2016 at 21:10:30 UTC, ag0aep6g wrote: Can you link that post, please? I can't imagine what "dynamic mixin" could refer to. Sure, it's here: http://forum.dlang.org/post/xmnnsdiuwyjrhkasy...@forum.dlang.org In that thread they also mention Object.factory, but the docume

Re: Parsing a string to instantiate classes at runtime

2016-11-27 Thread ag0aep6g via Digitalmars-d-learn
On 11/27/2016 10:02 PM, Marduk wrote: I read in an old post in these forums that with a dynamic mixin it is possible to add structures and classes at runtime. I searched "dynamic mixin" but I did not find more information. Can you link that post, please? I can't imagine what "dynamic mixin" co

Parsing a string to instantiate classes at runtime

2016-11-27 Thread Marduk via Digitalmars-d-learn
Dear all, I would like to write a program that: 1. Receives a string from the UI 2. Parses the string 3. Instantiates classes, whose names are contained in the string, passing parts of the string as constructor arguments. From my experience with other programming languages, I suppose I need