On Tuesday, 3 December 2019 at 15:12:46 UTC, Ola Fosheim Grøstad wrote:
On Tuesday, 3 December 2019 at 14:51:58 UTC, Adam D. Ruppe wrote:
Maybe, but it is pretty sound once you get to know it.

You mean contracts? Yes. But I was thinking of contravariant/covariant parameters on virtual functions. Doesn't work with overloading though, so D only has it on return types? Probably for the best. Perhaps.

Also the use of the term "covariant" here is confusing to me:

https://dlang.org/spec/function.html

My understanding is that covariant means that an enclosing type and the enclosed type have the same typing-relationship when specialized. Whereas contravariant means they are opposite. So you need two types for it to make sense. I.e. the schematic here:

https://en.wikipedia.org/wiki/Covariance_and_contravariance_(computer_science)#Inheritance_in_object-oriented_languages

But it the documentation "covariant" is used to describe a simple subtyping-relationship on one type?

Anyway, the wording is confusing. I think it would be hard on newbies, even if it was correctly used.

  • Re: interfaces and contrac... Ola Fosheim Grøstad via Digitalmars-d-announce
    • Re: interfaces and co... Adam D. Ruppe via Digitalmars-d-announce
      • Re: interfaces an... Ola Fosheim Grøstad via Digitalmars-d-announce
        • Re: interface... Robert M. Münch via Digitalmars-d-announce
          • Re: inter... Adam D. Ruppe via Digitalmars-d-announce
            • Re: ... Robert M. Münch via Digitalmars-d-announce
              • ... Adam D. Ruppe via Digitalmars-d-announce
              • ... Ola Fosheim Grøstad via Digitalmars-d-announce
              • ... Adam D. Ruppe via Digitalmars-d-announce
              • ... Ola Fosheim Grøstad via Digitalmars-d-announce
              • ... Ola Fosheim Grøstad via Digitalmars-d-announce
              • ... Adam D. Ruppe via Digitalmars-d-announce
              • ... Adam D. Ruppe via Digitalmars-d-announce
              • ... Ola Fosheim Grøstad via Digitalmars-d-announce
              • ... Ola Fosheim Grøstad via Digitalmars-d-announce
              • ... Adam D. Ruppe via Digitalmars-d-announce
              • ... Ola Fosheim Grøstad via Digitalmars-d-announce
          • Re: inter... Ola Fosheim Grøstad via Digitalmars-d-announce
  • Re: interfaces and contrac... Meta via Digitalmars-d-announce

Reply via email to