by unsafecast · 4y ago · 0 comments
trait X {
type Y<Z>;
}
You couldn't express "a thing that contains another thing" in one of those type expressions before, and also use the contained type. It's needed for Mappable, because it's an abstraction over the concept of modifying a value inside a container.IMO the implementation that they have is a bit obtuse, but I don't know if you can fit something better in this language.
As a library user, you can't copy-paste a line for a type you just created in a library you don't maintain.
Being able to do what you describe lets a maintainer create an interface for all the future types that satisfy given requirements.
print("Hello")
print("Hello2")
print("Hello3")
print("Hello4")
print("Hello5")
(which I partially copy-pasted above) but I use a for-loop instead.