| ▲ | Show HN: The Tsonic Programming Language(tsonic.org) |
| 42 points by jeswin 20 hours ago | 9 comments |
| You can see some examples here: https://github.com/tsoniclang/proof-is-in-the-pudding And a hugo clone (which compiles to native code) here: https://github.com/tsoniclang/tsumo Linux and macOS for now. |
|
| ▲ | DonaldFisk 2 hours ago | parent | next [-] |
| The original proverb is "The proof of the pudding is in the eating." See https://www.worldwidewords.org/qa/qa-pro1.htm |
|
| ▲ | zahlman 8 hours ago | parent | prev | next [-] |
| > Tsonic is a TypeScript to C# compiler So, not a separate language. |
| |
| ▲ | jeswin 7 hours ago | parent [-] | | Well, there are some additions - thought it can be compiled via tsc into js that would never run. This is still useful though for IDE and tooling support, language servers etc. The most important thing is that you have these types you can import. For example the "int" below: import { int } from "@tsonic/core/types.js";
function fibonacci(n: int): int {
if (n <= 1) {
return n;
}
return fibonacci(n - 1) + fibonacci(n - 2);
}
Instead of making it a keyword, I decided to export these from core/types.ts - so that the code can still be compiled with tsc, and all the tooling would still work. Similarly (among others), you'd use ptr<long>, if you wanted a pointer to a long. |
|
|
| ▲ | throwawaygod 2 hours ago | parent | prev | next [-] |
| Whats the debugger story like? Do we have to use Microsoft's proprietary dotnet debugger? |
| |
| ▲ | jeswin 2 hours ago | parent [-] | | At the moment, we have to use Microsoft's debugger on the generated code. I have it as a todo - but I don't think I'll get to it soon. |
|
|
| ▲ | mkl 6 hours ago | parent | prev | next [-] |
| The webpage is broken on mobile, as the lines go off the screen (Firefox Android). |
| |
| ▲ | jeswin 6 hours ago | parent [-] | | Thanks. I've just improved it, but still more to do. Will look at it this week. |
|
|
| ▲ | throwawaygod 8 hours ago | parent | prev [-] |
| Another typescript compiler similar to this: SharpTS[https://news.ycombinator.com/item?id=46557698] |
| |
| ▲ | jeswin 7 hours ago | parent [-] | | Wow, I never came across it - thank you. There are key differences though. What tsonic offers: (0) broad data type support, stack allocated types etc (1) nodejs and js compatibility libs, (2) the availability (in tsonic) of the entire .Net BCL, Asp.Net and EF Core as d.ts files (for example, in @tsonic/dotnet) so that tsc would still run, (3) bindings generator (tsbindgen) for any .net dll etc. What tsonic is missing: (1) interpreter, (2) compile to .Net IL. Tsonic will only do native code; and does so by converting ts to c# and then using the NativeAOT chain on generated C#. SharpTS is compiling straight to IL (I think), something I considered but decided not to for the time being. I think these are two different approaches. With pros and cons for both. |
|