BorrowScript icon indicating copy to clipboard operation
BorrowScript copied to clipboard

[Proposal] Enums and matching

Open alshdavid opened this issue 2 years ago • 2 comments

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

enum Foo {
  A = 'A',
  B = 'B',
}

alshdavid avatar Sep 30 '21 04:09 alshdavid

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.

agentcooper avatar Oct 01 '21 11:10 agentcooper

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 .

SuperSonicHub1 avatar Oct 01 '21 19:10 SuperSonicHub1