objeck / objeck-lang

Objeck is a modern object-oriented programming language with functional features tailored for machine learning. It emphasizes expression, simplicity, portability, and scalability. The programming environment consists of a compiler, virtual machine, REPL shell, and command line debugger with IDE plugins.
https://objeck.org
Other
154 stars 11 forks source link

ADTs #238

Closed Stonygeist123 closed 1 year ago

Stonygeist123 commented 1 year ago

Adding Rust-like ADTs and pattern matching would be pretty useful since it makes coding more elegant and easier

objeck commented 1 year ago

@Stonygeist123 Thanks for the suggestion; I will look into it. By AST you mean algebraic vs. abstract data types?

objeck commented 1 year ago

Should be able to provide TypeScript-level support by extending the alias keyword to include type unions.

Stonygeist123 commented 1 year ago

@objeck Both, algebraic and abstract data types would be neat. Though I am not sure if a class like in C++ would be better than a TypeScript-like union syntax.

objeck commented 1 year ago

Here's an interface-based solution. I do not think I need to add anything new to the language.

Stonygeist123 commented 1 year ago

Ok, looks nice.