aka “bros: in order to be rich, just don’t be poor.”

  • gedhrel@lemmy.world
    link
    fedilink
    arrow-up
    2
    ·
    1 day ago

    Neither covariant nor contravariant.

    supertype[] is not a supertype of subtype[] if supertype and subtype alone are in that relationship, because the mutability of arrays means that the Liskov substitution principle doesn’t hold.

    (These are all something you’ll probably find good explanations of on Wikipedia.)

    • tabular@lemmy.world
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 day ago

      Thank you for your reply. Sadly I don’t know terms like covariant or supertype either 😅 so I’ll have to look into all that when/if it comes up. I write in GDScript for fun (a game engine’s high-level scripting language said to have syntax similar to Python).