stdlib icon indicating copy to clipboard operation
stdlib copied to clipboard

Refactored list and dict to use Option type instead of Result for better ergonomics.

Open JosephShering opened this issue 3 months ago • 0 comments

This PR will update the standard library from using Result to using Optional

Why?

I found many of the list functions using Result were returning Error(Nil) or ignoring the user's passed error type.

Error(a) to me represents an unexpected outcome. Similar to a raise or throw in another language. Where we can then supply the developer inside with it's a value.

Filtering through a list, to not find the item, is not error worthy. The outcome is expected. Therefore, None is better, and at the same time we don't lose any data being returned to the developer. Since all of the previous implementations just returned Error(Nil) or ignored the a in Error(a) anyway.

JosephShering avatar May 03 '24 00:05 JosephShering