alshdavid / BorrowScript

TypeScript with a Borrow Checker. Multi-threaded, Tiny binaries. No GC. Easy to write.
1.45k stars 16 forks source link

[Proposal] Enums and matching #10

Closed alshdavid closed 1 year ago

alshdavid commented 3 years ago

TypeScript has enums with assignable values. In this context how would we support Rust-like enum matching capabilities

enum Foo {
  A = 'A',
  B = 'B',
}
agentcooper commented 3 years ago

On a topic related to enums and matching, I think there is a possibility to improve on how algebraic data types work in BorrowScript compared to TypeScript, please see https://github.com/microsoft/TypeScript/issues/36336.

SuperSonicHub1 commented 3 years ago

The suggested syntax looks very much not like JS, and what's the difference between this and mix-ins/inheritance?

On Fri, Oct 1, 2021, 7:21 AM Artem Tyurin @.***> wrote:

On a topic related to enums and matching, I think there is a possibility to improve on how algebraic data types work in BorrowScript compared to TypeScript, please see microsoft/TypeScript#36336 https://github.com/microsoft/TypeScript/issues/36336.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/alshdavid/BorrowScript/issues/10#issuecomment-932143421, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGDQCMRG75MEB3UWMUWWH2DUEWKSTANCNFSM5FBLFCKQ .