4 days ago
On Tuesday, 3 December 2019 at 16:03:18 UTC, Ola Fosheim Grøstad wrote:
> But this doesn't work in D.

That's my point - it is unsound in the static type system and D correctly rejects it. Might work in a dynamic language, but not in static.

> Yes, but when do you need to do it? So it is typesafe, but what would the use case be?

You could conceivably write a child class that wraps or converts. For example, perhaps:

class Serializer {
    void serialize(Serializable s) {}
}

class ExtendedSerializer: Serializer {
    override void serialize(Object o) {
        super.serialize(reflectToSerializable(o));
    }
}

I probably wouldn't do it that way... and I can't think of a time I actually used this myself which is why I had to make something up. But still, it conceivably makes sense.

> I've got a feeling that one could do something interesting with such semantics that would make all this variance-stuff cleaner... somehow. But I haven't given it a lot of thought. Just a feeling. :)

Maybe, I haven't thought a lot of it.
4 days ago
On Tuesday, 3 December 2019 at 17:17:15 UTC, Meta wrote:
> Which is still open, but Iain ran into stack corruption issues when compiling with the -m64 flag... and no further progress. So I guess it's just a matter of the bug not being fixed.

That's surprising. It could perhaps just use my pattern automatically and have a simpler implementation :)
4 days ago
On Tuesday, 3 December 2019 at 17:19:11 UTC, Adam D. Ruppe wrote:
> You could conceivably write a child class that wraps or converts. For example, perhaps:
>
> class Serializer {
>     void serialize(Serializable s) {}
> }
>
> class ExtendedSerializer: Serializer {
>     override void serialize(Object o) {
>         super.serialize(reflectToSerializable(o));
>     }
> }


But you can't do that in D either, or? (I am ok with it, having invariant parameters is an ok tradeoff).


Next ›   Last »
1 2 3