Struct polymorphism?
Era Scarecrow
rtcvb32 at yahoo.com
Mon Oct 8 20:23:37 PDT 2012
On Sunday, 7 October 2012 at 10:04:57 UTC, Era Scarecrow wrote:
> What are the possibilities of struct polymorphism? What would
> be the issues with it? What if we wanted to use it in a limited
> sense?
>
> Currently I'm experimenting with it since classes are too bulky
> for what I need, yet I really need some type of
> behavior/dynamic polymorphism. So far I have a working model.
> It takes the following limitations:
A question of efficiency comes up. If at compile-time we can
confirm only a couple branches/possibilities, then only those are
considered during run-time. During optimization is that code just
inlined to where it is called rather than the jump to opDispatch?
Seems like it should if it's small enough, especially if there's
only 1 possibility.
Now I guess a question out there for you all. Who would be
interested in an implementation and how would you use it? Does it
seem like a good idea? How many levels would you want to use?
One? Several levels allowing class-like inheritance?
More information about the Digitalmars-d
mailing list