Closed stugol closed 8 years ago
This is pretty much an impossible feat. It mixes the domains of static type resolution and run time value resolution. For type to be certain - in a certain position - the container cannot be dynamically extended, because then there cannot be a guarantee that the position actually holds a value of the promised type. And hence, strong type checking crumbles into a pile of doo doo.
Why would you possibly need it?
Does that issue suffice, we're on to something there, maybe this can be closed?
Sure, it should be a decent alternative. And more useful.
In Crystal, tuples are heterogenous, but cannot be extended or modified at runtime; while Arrays are extensible but homogenous. Ideally:
Come to think of it, might be better to turn this on its head: keep arrays homogenous, but make tuples editable: