On Thursday, 23 August 2018 at 13:22:45 UTC, Shachar Shemesh
wrote:
Because in D, structs can't inherit,
Forgive me if I'm not helping, but if you are willing to create a
little infrastructure, I think you can create polymorphic structs
with the technique described at
https://theartofmachinery.com/2018/08/13/inheritance_and_polymorphism_2.html. See https://gitlab.com/sarneaud/xanthe/blob/master/src/game/player.d#L18 for a concrete example.
I can't do that for structs, and if I defined SockAddr as a
class, I'd mandate allocating it on the GC, violating the whole
point behind writing Mecca to begin with.
There are other ways to allocate memory for classes, without the
GC. Do any of the techniques described at
https://wiki.dlang.org/Memory_Management#Explicit_Class_Instance_Allocation give you an alternative?
The general consensus, however, is that these problems will not
be resolved (we used to file bugs in Bugzilla. We stopped doing
that because we saw nothing happens with them), and as far as
the future of the language goes, that's bad news.
I've fixed 4 bugs in the past 2 weeks:
https://github.com/pulls?utf8=%E2%9C%93&q=is%3Apr+author%3AJinShil+archived%3Afalse+is%3Aclosed+Fix
But I admit they were quite simple. I agree, the more difficult
bugs tend to not get fixed. I've tried to fix a few of them, but
they were beyond my current abilities. Again, you might have
more success if you put some financial incentive behind them.
Mike