Re: Limited Semi-PolyMorphic (LSP) structs?

2013-09-02 Thread Era Scarecrow
Mixin is suppose to inject code as though you posted it there, correct? I've got a case with my LSPS function(s) where it fails my tests when I use the mixin, but if I copy/paste the output from the screen back into the source it works just fine. All these new headaches with the new version

Re: Limited Semi-PolyMorphic (LSP) structs?

2013-08-28 Thread Era Scarecrow
On Wednesday, 28 August 2013 at 15:20:34 UTC, Artur Skawina wrote: It's hard to tell what your actual requirements are; this discriminated union might help. It does a bit more than what you ask for, as it also gives access to /data/, not just methods; this shouldn't be a problem. Requirement

Re: Limited Semi-PolyMorphic (LSP) structs?

2013-08-28 Thread Artur Skawina
On 08/28/13 06:45, Era Scarecrow wrote: > On Wednesday, 28 August 2013 at 03:45:06 UTC, Andre Artus wrote: >> Era, >> >> I haven't had time to go through your everything you wrote here but are you >> looking to create some form of discriminated union (AKA tagged union) using >> D structs? >> >> D

Re: Limited Semi-PolyMorphic (LSP) structs?

2013-08-28 Thread Era Scarecrow
K got a prototype working, I know there's issues with it but for now it looks simple and acts the way it is suppose to (at least to the unittest) so... Had to use templates through all the functions in order for auto ref to work right (hopefully forwards what it needs...) /* //the only th

Re: Limited Semi-PolyMorphic (LSP) structs?

2013-08-27 Thread Era Scarecrow
On Wednesday, 28 August 2013 at 05:13:51 UTC, H. S. Teoh wrote: One trick that you may find helpful, is to use alias this to simulate struct inheritance: struct Base { int x; } struct Derived1 { Base __base; alias __base t

Re: Limited Semi-PolyMorphic (LSP) structs?

2013-08-27 Thread H. S. Teoh
On Wed, Aug 28, 2013 at 06:45:11AM +0200, Era Scarecrow wrote: > On Wednesday, 28 August 2013 at 03:45:06 UTC, Andre Artus wrote: > >Era, > > > >I haven't had time to go through your everything you wrote here > >but are you looking to create some form of discriminated union > >(AKA tagged union) us

Re: Limited Semi-PolyMorphic (LSP) structs?

2013-08-27 Thread Andre Artus
Era, I haven't had time to go through your everything you wrote here but are you looking to create some form of discriminated union (AKA tagged union) using D structs? Do you have a specific problem you need to solve, or are you just exploring the language?

Re: Limited Semi-PolyMorphic (LSP) structs?

2013-08-27 Thread Era Scarecrow
It just came to mind that what I want is almost more a unioned struct. Perhaps this will come up with something closer to what I am really looking for. assuming we could use a union, it would be closer to: //type is the identifier of which one it's going to be using union AB { iA ia; iB i

Re: Limited Semi-PolyMorphic (LSP) structs?

2013-08-26 Thread Era Scarecrow
On Monday, 26 August 2013 at 12:42:43 UTC, qznc wrote: Hm, my try would be alias this for inheritance and function pointers for virtual methods. struct iA { void function(iA) A; void C(); } struct iB { iA _a; alias this = _a; void B(); } If you have multiple "subclasses" for iA, you

Re: Limited Semi-PolyMorphic (LSP) structs?

2013-08-26 Thread qznc
On Monday, 26 August 2013 at 11:20:17 UTC, Era Scarecrow wrote: Been a while and out of the loop, I need to get my hands dirty in the code again (soon). Anyways, let's get to the matter at hand as I'm thinking about it. I'm working on some code (or will work on code again) that could use a pol

Limited Semi-PolyMorphic (LSP) structs?

2013-08-26 Thread Era Scarecrow
Been a while and out of the loop, I need to get my hands dirty in the code again (soon). Anyways, let's get to the matter at hand as I'm thinking about it. I'm working on some code (or will work on code again) that could use a polymorphic type, but at the end it will never be shared externally