vrok / have

The Have Programming Language
http://havelang.org
BSD 2-Clause "Simplified" License
272 stars 11 forks source link

Builtin interfaces for some language features #12

Open erizocosmico opened 8 years ago

erizocosmico commented 8 years ago

Now that the iterator interface has been mentioned in https://github.com/vrok/have/issues/10#issuecomment-251137899 i think it'd be nice to expand that context and make available some language features via interfaces.

For example, equatable:

type equatable[T] interface {
      Equals[T](T) bool
}

That would enable this:

if myCustomType == myCustomType2 {
// stuff
}
vrok commented 8 years ago

I'm not convinced about == operator overloading, I think it could hurt readability. I'm not closing the issue yet, I'll need to think about it.