5 comments

  • zahlman4 hours ago
    &gt; Tsonic is a TypeScript to C# compiler<p>So, not a separate language.
    • jeswin3 hours ago
      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.<p>The most important thing is that you have these types you can import. For example the &quot;int&quot; below:<p><pre><code> import { int } from &quot;@tsonic&#x2F;core&#x2F;types.js&quot;; function fibonacci(n: int): int { if (n &lt;= 1) { return n; } return fibonacci(n - 1) + fibonacci(n - 2); } </code></pre> Instead of making it a keyword, I decided to export these from core&#x2F;types.ts - so that the code can still be compiled with tsc, and all the tooling would still work. Similarly (among others), you&#x27;d use ptr&lt;long&gt;, if you wanted a pointer to a long.
  • mkl2 hours ago
    The webpage is broken on mobile, as the lines go off the screen (Firefox Android).
    • jeswin2 hours ago
      Thanks.<p>I&#x27;ve just improved it, but still more to do. Will look at it this week.
  • throwawaygod4 hours ago
    Another typescript compiler similar to this: SharpTS[<a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=46557698">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=46557698</a>]
    • jeswin3 hours ago
      Wow, I never came across it - thank you.<p>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&#x2F;dotnet) so that tsc would still run, (3) bindings generator (tsbindgen) for any .net dll etc.<p>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.<p>I think these are two different approaches. With pros and cons for both.
  • Kindercrusher2 hours ago
    [dead]