Could the logic of determining exhaustiveness of matches for enum variants be improved?

@KrishnaSannasi, I appreciate the creative solution that you went for above. However, aside from the scalability, it does seem to be also misleading to handle Buddhabrot as an Error, when it is just another type of fractal, like 5 others more that could be added (and perhaps only Mandelbrot and Julia are the ones with a common control flow like above). So even if nothing else is added and the solution works perfectly fine --- in which case I guess it's a bit more verbose than the alternative, but at least there's no need for dead code to be able to compile --- being misleading w.r.t. the nature of Buddhabrot is not that great either.

Perhaps this is too much of a niche case indeed, although I still have my doubts, but thanks again for your insight!

You don't have to use TryFrom, you can just as easily use a custom function/type. I just did so because it was convenient to me

You can also represent your Fractal like so, expresses your intent even more clearly, and doesn't require helper functions to convert between types!

enum Fractal {

enum Mandelbrot {

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.