dinfuehr / dora

Dora VM
MIT License
490 stars 31 forks source link

DRAFT: stdlib: add Comparing and Sorting to replace Int-returning compareTo/sortAs methods #265

Closed soc closed 2 years ago

soc commented 3 years ago

@dinfuehr Do you have an idea to turn -1/0/1 into Less/Equal/Greater / Before/Same/After without introducing additional branches?

(I guess one idea would be to return 0/1/2 instead and translate them into the enum variant tags?)

What do you think?

dinfuehr commented 3 years ago

Enums without arguments should already be simple integers, so both enums should already use 0/1/2 as values. (We might want to change the encoding to -1/0/1 but I guess that's initially not too important)

soc commented 2 years ago

Will pick this up again at a later date.