Introducing a New Type-Safe Language POC for JavaScript: Beyond TypeScript. Here is why ??

Introducing a New Type-Safe Language POC for JavaScript: Beyond TypeScript. Here is why ??

I've?developing a proof of concept for a new type-safe language that compiles to JavaScript. Here's why we think it's worth exploring.

Why Not Just Use TypeScript?

TypeScript is great, but it has limitations:

  • It doesn't support multiple inheritance
  • Interfaces can become complex and confusing
  • Cleaning up complex types can be challenging

Key Features of Our RJS:

Structs:

  • Provide a way to define custom data types with named fields
  • Offer a more rigid and predictable structure compared to JavaScript objects

Traits:

  • Promote composition over inheritance
  • Allow types to implement multiple traits
  • Facilitate code reuse without rigid inheritance hierarchies
  • Provide default implementations

Pattern Matching:

  • Built-in at the language level
  • Offers more powerful and elegant control flow
  • Particularly useful when working with structs and enums


Potential Future Goals:

Built-in Tooling: No need for additional packages for tree shaking, minification, etc., I aim to include these as part of the language superset.



rjs file


Transform:



Technical point

As you can see this is inspired by Rust and the POC has been written in Rust along with a simple typechecking system.

要查看或添加评论,请登录

Jordan Hall的更多文章

社区洞察

其他会员也浏览了