Hacker Timesnew | past | comments | ask | show | jobs | submitlogin

> Still compiles Down to js where you lose all type checking.

Yes and C still compiles to assembly with no type checking. What's your point?



C is an infamously unsafe language, so the question might rather be what _your_ point is.


> C is an infamously unsafe language, so the question might rather be what _your_ point is.

Feel free to insert Rust or Haskell or whatever your language of choice is in place of C and my point remains the same. Sure you can include type information inside the assembly output and some sort of runtime code to handle that, but that doesn't change the fact that your compile target has no type system. Typescript could do the same if they desired, and in fact I think they offer the option.

Compiling a language with a type system to a language without is not a knock against that language's type system. Compiling typescript's decently comprehensive/expressive compile-time type system to javascript's basic runtime type system actually seems like a step up compared to a lot of other compilation targets.


Like I have said elsewhere, Haskell and Rust and other such languages actually force you (to varying degrees) to write programs that are soundly typed at compile time. TypeScript explicitly doesn't, and instead treats program types in a way that's far more like Java or C# (which rely on both compile time and runtime type checking to enforce a program's types, and even at that are not entirely sound) without the runtime type checking to back it up.

> Typescript could do the same if they desired, and in fact I think they offer the option.

They very explicitly do not and have stated severally that it is not within the goals of the project to do so, which is something anyone actually familiar with the language should know.

> Compiling a language with a type system to a language without is not a knock against that language's type system

When you don't cherry-pick statements out of context, the point of what I said becomes rather obvious; if a language doesn't actually guarantee type safety at compile time, having a primary compilation target that takes a fascinatingly lax approach to data types is objectively worse (wrt type safety) than having one that's more strict.


Your posts don't make any sense. Rust compiles down to assembly too, but it's a safe language, so what? The compilation target has nothing to do with the relative safety of the language.


> The compilation target has nothing to do with the relative safety of the language

Yes, obviously. Almost as though the fact that all languages end up as x86 or ARM opcodes at the end of the day has literally nothing to do with the merits and demerits of their respective type systems, but people keep bringing it up like some kind of gotcha when type systems get criticized.


Mostly due to the way it's used for performance reasons. You can take other typed languages and pass around object information in byte buffers instead of structs as well, and subsequently lose all your type checking.


No, mostly due to actually having a weak type system. I have no idea why people think C is in any way strongly typed just because it has static types.


> I have no idea why people think C is in any way strongly typed just because it has static types.

Do you think that's an opinion I have expressed here?




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

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

Search: