2 ms·
I wonder if this would be a good opportunity to use a typing system that's more like Go's, where you don't need to explicitly declare that a class implements an
by ninkendo 8y ago
I wonder if this would be a good opportunity to use a typing system that's more like Go's, where you don't need to explicitly declare that a class implements an interface, but instead any class that has the right methods will implement the right interfaces automatically.
(In your example the method could be:
def foo(source: Shiftable<?>)
dosomething(source.shift)
end
where `Shiftable` is an interface that's something like
iface Shiftable<T>
.shift(): T
end
)