FR version is available. Content is displayed in original English for accuracy.
Advertisement
Advertisement
⚡ Community Insights
Discussion Sentiment
63% Positive
Analyzed from 3923 words in the discussion.
Trending Topics
#rust#java#types#languages#language#arc#more#type#don#code

Discussion (90 Comments)Read Original on HackerNews
Tutorials and books should be more open about that, instead of pushing complex lifetime hacks etc., also show the safe and easy ways.
The article gives Java a worse devx rank than Go and I can't agree. Java is at least on par with go in every aspect of devx, and better in IDE support, expressiveness, and dependency mgmt.
As usual, this depends heavily on what you do. I had written a program where Arc reference counting was 25 % of the runtime. All from a single instance as well. I refactored to use borrows and annotated relevant structs with lifetimes. This also enabled additional optimisation where I could also avoid some copies, and in total I saved around 36% of the total runtime compared to before.
The reason Arc was so expensive here is likely that the reference count was contended, so the cacheline was bouncing back and forth between the cores that ran the threads in the threadpool working on the task.
In conclusion, neither extreme is correct. Often Arc is fine, sometimes it really isn't. And the only way to know is to profile. Always profile, humans are terrible at predicting performance.
(And to quite a few people, coming up with ways to avoid Arc/clone/Box, etc can be fun, so there is that too. If you don't enjoy that, then don't participate in that hobby.)
Again, depends on what you are doing. If you are doing web servers, electron apps or microcontrollers, sure. If you are doing batch computation, games, simulation, anything number crunchy, etc: no. As soon as you are CPU or memory bandwidth bound, optimisation does matter. And if you care about battery usage you also want to go to sleep as soon as possible (so any phone apps for example).
You're likely to get more pushback when creating public crates: you don't know if it's going to be someone else's hot path.
But the internal code for pretty much any major rust shop contains a lot more Arc, Box and clone than external code.
I think it's fair to say Java's "syntax ergonomics" are a little below the rest / somewhat manual like rust or C++ by default.
Yes. Rust is incredible in all these respects, perhaps the best, however the readability is just not good in comparison with e.g. Swift. This is probably due to language limitations like a lack of variadic generics, one of the reasons there are macros everywhere in Rust codebases, which severely hampers readability.
I think a lot of devs are missing out by not considering Scala 3. I use it with the Zio effect system which brings composable concurrency and transactional memory amongst other features. I don't think there is anything comparable in any of the languages listed in TFA.
Do you have any numbers to back you up? That statement sounds very, very wrong to me
RedMonk shows Scala is comparable to Go and Rust [0] You can see in this chart which plots the number of projects on Github and tags on StackOverflow (ha ha.)
The upper right most cluster has the most popular languages (C++, Java, Python, JS, PHP, TypeScript) then the next cluster has Scala with Rust, Go, Kotlin, R, Swift, etc... That cluster is clearly separate from the next less popular one which has Haskell, Lua, Ocaml, Groovy, Erlang, Fortran, etc... and then you can see the long tail is a big cluster covering the entire lower left half of the chat with a clear gap between it and the upper right half.
I don't think it is a "very, very wrong" statement.
[0] https://redmonk.com/sogrady/files/2025/06/lang.rank_.125.wm_... which comes from https://redmonk.com/sogrady/2025/06/18/language-rankings-1-2...
> but types lie at runtime (unsound) requiring you to add your own runtime checks.
I don't recall doing that outside of situations when data is crossing system boundaries.
The vast majority of languages have an unsound type system, yet people are productive in them.
Over the years I've come to realise it's a form of nitpicking. You absolutely need it in some applications, but it's not an important requirement most of the time and it's given undue importance by some.
I believe it’s largely because of these defaults that the idea that TypeScript isn’t really checking types persists. Without the any type, or loose undefined and null checks, your types are as validated as they can be. The only failure point is deserialization or an import which doesn’t type check. And deserialization has this problem in every language.
When you compile C to machine code the executed binary isn’t checking types. This is no different from Typescript that’s been compiled to JavaScript.
Is there a name for this failure mode?
That's not the reason.
TypeScript's main design goal was to enable developers to gradually introduce types in codebases that spent years being written purely in JS.
There's still demand for this feature and those who start off with TypeScript set their own config anyway.
I've dealt with people using all kinds of escape hatches, but 2/3 of the time it's caused by lack of proficiency in the language.
The rest is either someone being in a hurry or just not serious about their job.
The lighter version he describes would make some assumptions that reduce not just the mental overhead but importantly the _syntax_ overhead. You cant have Arc<dyn Animal> if what you describe is an Animal and the readability is infinitely more important than performance. But if you could create a system where in the lighter Swift/C#-like syntax things are automatically cloned/boxed while in the heavier Rust they aren’t, then maybe you could use Rust everywhere without a syntax tax.
I like the style you're describing, thanks for sharing.
In our benchmarking, we've found LLMs perform comparably between languages for one-shot coding submissions, slightly favoring more popular languages. But if you give frontier LLMs a harness and let them iterate / fix compilation errors, they actually significantly outperform in Rust. Meaning, they come up with more insightful ideas when developing Rust, than for example Javascript.
Scroll down to the language comparison chart: https://gertlabs.com/?agentic=agentic
I also think it's much better with languages with more guardrails and clear syntax: think expressive types (sum types), brackets, and linters / compile checks.
Rust has expressive types and lots of compile checks to avoid classes of bugs via ownership / lifetimes and I think makes it a very good tool for agents to use.
That said, I laud crystal for doing what ruby would not. It's a great language, but I doubt it'll ever make it to even ruby usage numbers.
What they apparently mean is how "ergonomic"/"expressive" the actual syntax and type systems of those languages are. In that case c# is ahead of java by a decent margin. Luckily java is still evolving, usually by stealing many of the good ideas from other languages like kotlin. But overall those are less language and more runtime features like project looms green threads etc.
It's a little bit nicer to write but that's almost irrelevant.
It also comes with some runtime cruft.
In reality there is no Kotlin without Java, which means most projects end up a bit 'dual'; every single Kotlin project we've had (except Android) folded back onto Java. Even Scala wasn't worth it, though that's a different question.
That might land with native unions but it's not there yet. There's workarounds with OneOf and Dune but those are kind of messy.
I think expressive types on dotnet are possible - I am a big fan of F# and those types are very good. So I think C# will get there but I can't say it's there yet.
Everything is ARC. Clones are cheap. But you still have a reasonable sound type system and no garbage collection.
I get it. Tooling on swift is meh the further you are from Apple, so I’m not suggesting it’s better.
But from a language point of view; is it not essentially a high level rust?
Ps. I don’t really know swift. Just asking where/why I’m wrong really.
https://docs.swift.org/swift-book/documentation/the-swift-pr...
... which is what I thought people were referring to.
Yes - it's ref counting, but it's not like 'Arc' at all - ARC is way more thread aware and most 'access' doesn't have to do thread checking. Much faster.
So - using Rust 'Arc' would not be at all like using Swift 'ARC' in the end.
What does "types in typescript are lies" even mean? Typescript from my experience has a fairly robust typing system with union types etc that many other languages called out lack (java, etc)
Is it a "lie" because it compiles to js? Compiler guarantees still stand regardless of whether you target IR, bare metal CPU instructions, etc. "any" types are definitely a foot gun, sure, but it I wouldn't call ts' type system a "lie" and not explain what that means. The ts language and ecosystem definitely has it warts, but in general those warts aren't the type system.
EDIT: correction, turns out I was fooled by ts lies all along. They allow clear type violations in several cases by design as pointed out elsewhere in this thread. Shame on them I guess. That said I've been using typescript in strict mode heavily for a year and it's good enough. Apparently there are some knarly edge cases hiding around several corners...yikes
Another observation is developer experience. Again, have you written _any_ Rust? I would argue that the reason Rust is such a joy to use is that the compile time errors are amazing, the way docs are handled are amazing, and so on. I know the eco system for something like Typescript is worlds better, but have you ever tried to _really_ understand what shenanigans are going on behind the scenes on some random hook from say, React? Their docs are so dismal and sparse and make assumptions on what they think you should know. Rust? You go to the doc gen, read what they think you should know as an overview, and if it isn't enough, I can click on "source" to dive deeper. What more could I possibly want?
Perhaps I'm just triggered. The discussion on Rust always seems to be fad or hype driven and almost always have very little to do with how it is to actually use it. If I have to read about compile times, again, I'm going to scream. Of all the languages I've used, it is one of the best in terms of a mature project needing new features or refactors. This is mentioned in some articles, but mostly we hear about "velocity" from some one dimensional perspective, usually someone from the web space, where it is arguable if the person should even bother trying to use Rust in the first place.
Apologies for the rant, but at this point I think Rust as a buzz word for article engagement has become tiring because it seems clear to me that these people aren't _actually_ interested in Rust at all. Who gives a shit what someone on Reddit thinks of your use of clone??
It is too easy to trap yourself in by sprinkling in Sized and derive(Hash) ontop of your neat little type hierarchy and then realize, that this tight abstraction is tainted and you cant use dyn anymore. As a follow up trigger: This was when i learned derive macros :)
Agree that the types accomplish basically exactly what I want.
If it gets a decent community / ecosystem I think it would be a frontrunner for sure, especially for web apps.
One potential issue is that the runtimes it targets are not that great at processing - they fanout well on BEAM but may not be the best for heavy processing. Not a deal breaker but smth that others like F#, OCaml, Rust can outperform in if the other attributes do well.
There is! From my understanding, Check out the gleam discord server and communities around it.
There are some good web frameworks in Gleam like lustre. I feel like you are gonna love this guy's videos: https://www.youtube.com/watch?v=3kr4Ydx6GGU
> One potential issue is that the runtimes it targets are not that great at processing - they fanout well on BEAM but may not be the best for heavy processing. Not a deal breaker but smth that others like F#, OCaml, Rust can outperform in if the other attributes do well.
I can agree to that. Gleam as a language is still not the best for these things (currently) but it supports the ability to transpile to Javascript and I feel like there are multiple things that gleam can and might be doing to make things faster, so in a sense I am hopeful about their future!
I feel like gleam can be considered as the modern ruby in some sense if one bets on it and to be honest, ruby wasn't slowed by many of these things and even right now some major projects even backend wise are written in ruby (homebrew comes to my mind) so it depends but yea, personally I am a gopher fan. I really love its simplicity for the most part, There are some interesting projects in the golang world where people are starting to transpile to golang from a more rust-y flavour/feeling. Some were on Hackernews recently, I would recommend checking them out if you might have some free time to tinker around!
And thanks for responding to this comment and have a fun time tinkering, personally I really like to sometimes just print hello world in different languages, I don't know what there is about them but printing hello world makes me happy but as such I just know the very basics of a language and I haven't played with them to a deeper level but just basics and watching videos about new languages etc., I like learning about new languages even if I might not use them personally.
I recommend watching tom delande's video of rating languages as well, that video was one of the thoughts which had come when I was reading the article/the discussion: https://www.youtube.com/watch?v=-MbTj8DGOP0 I think you might enjoy it and have a nice day Sirhamy!
If you want to see high level rust, check out Dioxus. It's a web framework, and it's extremely React-like both in architecture but also ergonomics. I actually had AI migrate a JS project to Dioxus and I think it was something like 75% of the code. Pretty decent for a "low level" language.
What this optimizes for is not actually having to deal with the pain in the ass that proper Rust is, but still allowing you to be in the cool kids club writing "blazingly fast software", all while writing what's pretty much Java or C#, but with a terrible non-functional garbage collector instead of a state of the art one.
What garbage collector?
Skill issue
So someone looking for the perfect languages while actively using the only two languages I actively avoid is very strange to me.
C# has close to zero community and only really works properly in Windows which is far past its glory days. Except for Microsoft aggressively pushing it as a Java alternative it has no right to exist.
Rust is an overcomplicated subset of C++ that solved memory problems the most recent versions of C++ don't have anymore, and only survives by aggressive marketing, full of grouping things together that don't belong together, like C/C++. And memory safety / use-after-free.
If C and C++ are basically the same because they have access to manual memory allocation then Rust/PHP are also basically the same.
And Rust's borrow checker only solves use-after-free which statistically are 10% of memory related vulnerabilities. Not "memory safety" of which 60-70% is just array out of bounds.
Really the worst two languages that both only survive in aggressive marketing.
What do you mean with this? Maybe you are thinking of the old ".NET Framework" runtime, which only runs on Windows? Nowadays there is ".NET Core" which runs on macOS and Linux as well.
You're missing a very fundamental point here, and this is usually something I find with long time C programmers. C is a great, but old language, with decades of overhead on context, tooling, and lib understanding that make getting in to writing C substantially more difficult than say, Rust. We are still humans, and Rust isn't entirely trying to solve C from a fundamental paradigm of handling memory from a technical point of view, but more from a programmer one. Your comment about solving memory bugs is predicated on perfect human usage of C to not write the bug in the first place, which is precisely one of the many problems Rust is looking to solve.
Haven't had anymore issues programing in C# on Linux than on Windows (if not less).
Rust certainly isn't as complicated as C++, and the complexity over C is well worth it, specially given the better ergonomics. Writing properly safe code on C or C++, however, will basically have you emulate the Rust compiler through tooling or inside your brain, which bears its own complexity.
Don't get me started on the PHP/Rust comparison, what is even the similarity here?
This just reeks of bad faith.