I realized today that Enum.take_random/2 can enter an infinite loop if someone calls it with an unbounded Stream as the enum. I also see that there‘s a warning of sorts (although nothing expressly mentioning a Stream as an enum), but I‘m not sure this is going to address user confusion by this behavior.
Would it make sense to emit a warning when using a Stream as an argument to take_random/2? Clearly since it‘s possible for this to _not_ get stuck in an infinite loop when using a steam we shouldn’t error, but a warning might at least help folks call something that converts the stream to a list before calling take_random/2. Thoughts? -- _________________ Devon Estes +49 176 2356 4717 www.devonestes.com -- 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/CAGowJci%2BZ9hbg%3DVheXOqemF_PJ2YDQOn9aua0w-ejpYPHGnPwg%40mail.gmail.com.
