Hacker Newsnew | past | comments | ask | show | jobs | submit | jeswin's commentslogin

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.

Thanks.

I've just improved it, but still more to do. Will look at it this week.


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.


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.

I did a Show HN for a language called Tsonic yesterday, which is a variant of TypeScript (all tsonic is valid typescript) requiring stronger typing which compiles to x64/ARM native code via .Net/NativeAOT. https://news.ycombinator.com/item?id=46604308

It didn't appear in Show HN at all. Perhaps because another user posted it as a regular topic just a few minutes earlier, which drops off very quickly (within minutes) - but I think the issue is wider.

For a while now, I've felt that the new topics stream requires you to promote the topic outside of HN to be seen on HN - sometimes by adding a "Discuss on HN" link in the blog, or on social networks etc. The problem is quite fundamental: the "Show" link gets a small fraction of clicks. The "Show New" (two clicks away) probably gets tinier, miniscule fraction of clicks. The intersection of people who are interested in the project and those who have clicked "Show New" would be very nearly null. So upvotes will have to come from outside.


That's great! It didn't make the /show page because some of the upvotes were dropped by our software. We can re-up it, but first can you add some text to the post, explaining the background and what's different about it? If you look at what I told the Lax guys earlier (https://news.ycombinator.com/item?id=46608577), that might give some ideas.

Also, if you're ok with changing the title to "Show HN: The Tsonic Programming Language" then I could add it to https://news.ycombinator.com/showlang :)


I did a Show HN for the language "hyTags" yesterday, too. It's a language embedded in HTML, using tags as syntax. It quickly dropped of the new page:

https://news.ycombinator.com/item?id=46599403

Could you add that too to showlang?


Sure! But I tried to restrict it to threads that got (interesting) comments, and there aren't any yet in that one. So let's put it in the SCP* as well :)

* https://news.ycombinator.com/item?id=26998308


Thanks dang!

Hi dang, done. Thank you!

Your feedback on the other thread was very helpful - just the right thing to add, irrespective of HN visibility.


Well ... I was going to do a Show HN. Can you edit the title? :) @todsacerdoti

Yes performance is a big issue, and so is security (or the lack of it). I'm attacking this from another angle: https://github.com/tsoniclang/tsonic

Write TypeScript, compile to native code via CLR's NativeAOT. We're almost there, you can see some examples here: https://github.com/tsoniclang/proof-is-in-the-pudding

You get everything; real multithreading, stack allocated types, single binary output (x64, ARM64 for Linux/MacOS) etc.


I cannot understand the idea of using JavaScript that compiles into "native code".

At what point do JavaScript developers need to realise that this is all convoluted, and begin to use languages better suited for the job.

You want something that can compile into a binary with multiple architectures, multithreading, types, etc? Please use a different language that's built from the ground up to achieve that.

You want something that was designed to add some sugar onto a website? Then yes JavaScript is probably best there.

Not everything needs to be written in this one language that's not designed for it. Just because you can, doesn't mean you should.


Actually TypeScript is an excellent language (in my view) for targeting native code. It reads cleaner than Java, C# and even golang in many cases - at least to me.

For example, JS/TS's file-path based imports are more intuitive; several languages do it via explicit namespaces when well-written code is already organized into directories. Of course, all of these design choices are subjective. In fact, disagreement with a few people in the C# user community is one of the reasons I started this project.

Another example - top level functions, being able to export them trivially etc.

> At what point do JavaScript developers need to realise that this is all convoluted, and begin to use languages better suited for the job.

I'd like to know what makes TS convoluted. Here's an example of multi-threading: https://github.com/tsoniclang/proof-is-in-the-pudding/blob/m...


The comment was especially about TypeScript. Unlike the ancient JavaScript versions best used for web sugar you're possibly thinking of, it's a highly pragmatic and well designed general purpose programming language with an unique and very powerful type system.

I guess it's because of the already available packages

Typescript is an excellent language, though. I don't blame people for wanting to hang on to it.

I have a GM1, it's truly a standout camera. GM5 makes it even better. It's quite funny nobody wants to attempt similar sizes, even when the market has voted for pocketable cameras.

Especially OM - with all their troubles, if it were me I'd have pivoted the company to sizes that do justice to the mount's inherent size advantage. They have a rich legacy of amazing small cameras (Trip, Pen, XA series, and the overrated mju ii) - yet it's fuji selling an order of magnitude more x-halfs than anything OM is producing.


I spent ~$1500 (and a bit more than two months) building a compiler that translates typescript to native binaries. I think I'll be able to do a Show HN later this month. It's the best $1500 I've ever spent on anything related to software development or computers.

You're not addressing the idea in the post, but the person. What the author achieved personally is irrelevant. What's important is that a very large and important industry is being completely transformed.

Add: if I did it without LLMs it would have taken me a year, and would have been less complete.


"building a compiler that translates typescript to native binaries"

Is a really weird way to say that you built a native compiler for typescript.


> Is a really weird way to say that you built a native compiler for typescript.

Well, the Typescript team is rewriting their compiler (landing in v7) in go, and some ppl call it the native compiler. I think my statement is clearer? But then English is not my first language, so there's that.


> that the company who helped champion the network effects of the internet and surface truly useful search results...

The amount of data on the web crossed the threshold of organic discoverability some time before the AI boom started. AI makes it go from really bad to really, really bad (99% to 99.99%). As far as I am concerned it doesn't change anything.

The same mechanisms to find good content would work today as well - following humans and networks.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: