shoki icon indicating copy to clipboard operation
shoki copied to clipboard

Shoki smart constructors support element type widening

Open jnape opened this issue 3 years ago • 0 comments

Since shoki data structures are immutable, this should type-check:

interface Animal {}
class Dog implements Animal {}
class Cat implements Animal {}

StrictStack<Animal> animals = Shoki.strictStack(StrictStack.<Dog>strictStack());

...and perform no additional allocations.

jnape avatar Aug 16 '21 18:08 jnape