You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Immutable Array may be more convenient in some cases; For example
class Shape; ...; end
class Circle : Shape; ...; end
class Rect : Shape; ...; end
class Renderer
def self.render(shapes: Array<Shape>); ...; end
end
# This is inferred as `Array<Circle>`
let circles = [Circle.new(1), Circle.new(2)]
# This is type error now - but this will be safe if `Array` is immutable.
Renderer.render(circles)
The text was updated successfully, but these errors were encountered:
Motivation
Array
may be more convenient in some cases; For exampleThe text was updated successfully, but these errors were encountered: