This is a good point. I was looking for an example of how these protocol changes could allow us to make some enumerables not allow negative access. No existing thing in the language is a good example, though, because we would break current behaviour.
It does present the interesting option of adding an `infinite` boolean field, defaulting to false, to the Stream struct and having the exhaustiblity protocol function check that. Then stream constructors that are known to generate infinities like Stream.cycle could opt-in to erroring on negative access. Stream modifiers known to 'curb' the infinities could reset it to true. Ambiguous operations would leave it unmodified. My exhaustible impl attempt will come well after my take on Enumerable.fetch, so I'm not really thinking very hard about this yet––just spitballing. But definitely the intention is not to have exhaustible? do any work, merely allow Enumerable implementers outside of core to opt-out of negative integer access if they wish. -- You received this message because you are subscribed to the Google Groups "elixir-lang-core" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/ddd26229-a8e9-4e2a-abf5-18cb545023d9%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
