forked from microsoft/TypeScript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.showcase.yml
21 lines (16 loc) · 2.13 KB
/
.showcase.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
size: big
description: |
I am very excited about Rust's meta-programming system. One of the most impressive features of Rust macros is that they allow for compile-time code execution with no performance penalty. This is a huge boon for developers, as it enables them to create a truly seamless programming experience.
Unfortunately, my other favorite programming language, Typescript, does not support compile-time code execution. Although I have long admired Typescript's many strengths, the lack of support for Rust macros has always been a sticking point for me. In an effort to overcome this limitation, I have decided to create my own implementation of compile-time code execution in Typescript.
My project allows users to define their own macros using a new keyword, which I have named **macro**. These macros are simply normal functions that are called at compile time during transformation, as well as during checking. This means that they can be used to generate both code that will be emitted in the final output, as well as types that can be used during development by the language server to provide IntelliSense and other code actions.
In addition to implementing support for Rust macros, I have also included several other features that I have always wanted in Typescript. These include:
- `defer` statements: similar to Go's defer, but can be used with any statement or block, not just functions.
- `derive` implementations for classes: works like `implements` or `extends`, but with the implementation generated by a macro.
- `using` statements: similar to C#'s using for `Disposable`.
- Operator overloading.
- Custom compiler options (build config).
To help other developers get started with this fork of Typescript, I have created a set of demos, which can be found at [https://github.com/laurci/ts-fork-demos](https://github.com/laurci/ts-fork-demos). I have also developed a VS Code extension that adds syntax highlighting for the new keywords I have introduced. The extension can be found at [https://github.com/laurci/ts-fork-vscode](https://github.com/laurci/ts-fork-vscode).
tags:
- compiler
- Typescript
- meta-programming