php is great because it's a statically-typed language with types less expressive than pre-generics java and that lets invalid code run because it doesn't actually do static type checking at all

this toot inspired by my realising php doesn't support return type covariance and will crash out fatally if you try to do covariant things with return types, even though it has a keyword (self) that appears to be specifically intended for doing covariant things with return types

it turns out c♯ also does not support return type covariance

so c♯ sucks actually

@AdrienneCohea sure! here's the simplest possible case:

class Base {
public Base getSelf() {
return this;
}
}
class Derived extends Base {
public Derived getSelf() {
return this;
}
}

this is well-typed from a theoretical perspective, and it typechecks in java and scala, but not in in c♯

@lizardsquid @AdrienneCohea i haven't got a c# compiler handy to check, but probably something about incompatible method signatures? since the subclass version of a method needs to be compatible with the superclass version of the same method, and all that

Sign in to participate in the conversation
Computer Fairies

Computer Fairies is a Mastodon instance that aims to be as queer, friendly and furry as possible. We welcome all kinds of computer fairies!