core-lang / core

The Core Programming Language
https://core-lang.dev
MIT License
45 stars 1 forks source link

rename `Result` variants `Ok`/`Err` to `Pass`/`Fail` #62

Open soc opened 1 year ago

soc commented 1 year ago

I was never too happy with the existing naming approaches for the Result type:

Success/Failure

Ok/Err


The new naming ticks all the boxes:

Pass/Fail

It's a minor thing, but it's nice to have found a good design even where it doesn't matter that much!

The only concern I have is that I might find a type in a testing-related context where Pass/Fail would fit even better!

soc commented 1 year ago

After the implementation of https://github.com/core-lang/core/issues/8, Option and Result could actually "share" the good case:

class Some[T](val: T)
module None
enum Option[T] of Some[T], None
enum Result[T, E] of Some[T], ???[E]

This still leaves open the question what to call the non-success variant of Result.

soc commented 5 months ago

Adrian from Coffee Compiler Club mentioned Is and No as a possibility. :-)