TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Rewriting Rust

368 pointsby yett8 months ago

43 comments

gary17the8 months ago
&gt; The rust RFC process is a graveyard of good ideas.<p>I actually have quite an opposite view: I think the Rust core team is 100% correct to make it very hard to add new &quot;features&quot; to the PL, in order to prevent the &quot;language surface&quot; from being bloated, inconsistent and unpredictable.<p>I&#x27;ve seen this happen before: I started out as a Swift fan, even though I have been working with Objective-C++ for years, considered it an awesome powerhouse and I did not really need a new PL for anything in particular in the world of iOS development. With time, Swift&#x27;s insistence on introducing tons of new language &quot;features&quot; such as multiple, redundant function names, e.g., &quot;isMultiple(of:)&quot;, multiple rules for parsing curly braces at al. to make the SwiftUI declarative paradigm possible, multiple rules for reference and value types and mutability thereof, multiple shorthand notations such as argument names inside closures, etc. - all that made me just dump Swift altogether. I would have to focus on Swift development exclusively just to keep up, which I was not willing to do.<p>Good ideas are &quot;dime a dozen&quot;. Please keep Rust as lean as possible.
评论 #41656463 未加载
评论 #41658739 未加载
评论 #41656513 未加载
评论 #41656086 未加载
评论 #41656756 未加载
dist1ll8 months ago
I think the dependency situation is pretty rough, and very few folks want to admit it. An example I recently stumbled upon: the cargo-watch[0] crate.<p>At its core its a pretty simple app. I watches for file changes, and re-runs the compiler. The implementation is less than 1000 lines of code. But what happens if I vendor the dependencies? It turns out, the deps add up to almost 4 million lines of Rust code, spread across 8000+ files. For a simple file-watcher.<p>[0] <a href="https:&#x2F;&#x2F;crates.io&#x2F;crates&#x2F;cargo-watch" rel="nofollow">https:&#x2F;&#x2F;crates.io&#x2F;crates&#x2F;cargo-watch</a>
评论 #41655752 未加载
评论 #41655311 未加载
评论 #41657113 未加载
评论 #41655559 未加载
评论 #41655288 未加载
评论 #41655397 未加载
评论 #41656010 未加载
评论 #41660917 未加载
评论 #41655455 未加载
评论 #41657310 未加载
评论 #41655337 未加载
评论 #41655255 未加载
评论 #41657385 未加载
评论 #41656091 未加载
评论 #41655363 未加载
评论 #41657470 未加载
评论 #41655275 未加载
评论 #41655442 未加载
bjackman8 months ago
Rust isn&#x27;t an Exciting New Language any more. It&#x27;s in the &quot;work towards widespread adoption&quot; phase. Slower feature development is natural and healthy, the stakes are high, mistaken design choices are much more harmful than low velocity at this point.<p>I&#x27;m not excited about Rust because of cool features, I&#x27;m excited because it&#x27;s a whole new CLASS of language (memory safe, no GC, production ready). Actually getting it into the places that matter is way more interesting to me than making it a better language. That&#x27;s easier to achieve if people are comfortable that the project is being steered with a degree of caution.
评论 #41655996 未加载
评论 #41657178 未加载
评论 #41657410 未加载
knighthack8 months ago
Since Rustaceans are so neurotic about rewriting everything in Rust, I genuinely thought that an article about rewriting Rust (in Rust) had to be a meta-satirical joke.
评论 #41655775 未加载
评论 #41656000 未加载
评论 #41655566 未加载
评论 #41655824 未加载
dathinab8 months ago
It&#x27;s kinda strange how he complains first about a slow decision making process and then lists features which are not stabilized for reasons fully unrelated to the decision making.<p>E.g. corutines are stuck because they have some quite hard to correctly resolve corner cases, i.e. in the compiler there isn&#x27;t a full implementation you could &quot;just turn on&quot; but a incomplete implementation which works okay for many cases but you really can&#x27;t turn on on stable. (At least this was the case last time I checked.) Similar function traits have been explicitly decided to not be stabilized like that for various technical reasons but also due to them changing if you involve future features. (Like async corotines.) Sure the part about return values not being associated types is mostly for backward compatibility but it&#x27;s also in nearly all situations just a small ergonomics drawback.<p>And sure there are some backward compatibility related designs which people have loved to do differently if they had more time and resources at the point the decision was made. But also most of them are related to the very early rust times when the team still was much smaller and there where less resources for evaluating important decisions.<p>And sure having a break which changes a bunch of older decisions now that different choices can be made and people are more experienced would be nice. BUT after how catastrophic bad python2-&gt;python3 went and similar experiences in other languages many people agree that having some rough corners is probably better and making a rust 2.0. (And many of this things can&#x27;t be done through rust editions!)<p>In general if you follow the rust weekly newletter you can see that decisions for RFC acceptance, including for stabilization are handled every week.<p>And sure sometimes (quite too often) things take too long, but people&#x2F;coordination&#x2F;limited-time problems are often harder to solve then technical problem.<p>And sure some old features are stuck (corotines) and some but also many &quot;feature gates&quot; aren&#x27;t &quot;implemented stuck features&quot; (but e.g. things which aren&#x27;t meant to be ever stabilized, abandoned features, some features have multiple different feature gates etc.)
mplanchard8 months ago
Shouldn’t read this without also reading Josh Triplett’s comment in response on reddit. One of the core examples in this post is just plain wrong (mutexes), for example: <a href="https:&#x2F;&#x2F;old.reddit.com&#x2F;r&#x2F;rust&#x2F;comments&#x2F;1fpomvp&#x2F;rewriting_rust&#x2F;lozktuv&#x2F;" rel="nofollow">https:&#x2F;&#x2F;old.reddit.com&#x2F;r&#x2F;rust&#x2F;comments&#x2F;1fpomvp&#x2F;rewriting_rus...</a><p>Edit: nevermind, comment is here too: <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=41655268">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=41655268</a>
gyre0078 months ago
One of the things that hit me when I was picking up Rust was that I felt like it had every imaginable feature one could think of - I dont know if Rust team said no to anything (yes I know they obviously must’ve done) - and yet people wanted more and more (some justifiably, others less so) as the language “felt” incomplete or that the features thatd be used by 2% of devs are totally necessary in the language that is “understood” by 1% of developer populace. I’m not saying the author is wrong here, just pointing out how a complex language somehow needs to be even more complicated. Spoiler: it doesn’t. Zig is simpler, arguably faster, with much less drama in the community. I wish more funding went to Zig.
评论 #41655805 未加载
评论 #41656053 未加载
评论 #41655424 未加载
评论 #41655476 未加载
评论 #41655594 未加载
评论 #41662396 未加载
评论 #41655692 未加载
评论 #41655514 未加载
评论 #41655562 未加载
JoshTriplett8 months ago
&gt; Now, there are issue threads like this, in which 25 smart, well meaning people spent 2 years and over 200 comments trying to figure out how to improve Mutex. And as far as I can tell, in the end they more or less gave up.<p>The author of the linked comment did extensive analysis on the synchronization primitives in various languages, then rewrote Rust&#x27;s synchronization primitives like Mutex and RwLock on every major OS to use the underlying operating system primitives directly (like futex on Linux), making them faster and smaller and all-around better, and in the process, literally <i>wrote a book</i> on parallel programming in Rust (which is useful for non-Rust parallel programming as well): <a href="https:&#x2F;&#x2F;www.oreilly.com&#x2F;library&#x2F;view&#x2F;rust-atomics-and&#x2F;9781098119430&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.oreilly.com&#x2F;library&#x2F;view&#x2F;rust-atomics-and&#x2F;978109...</a><p>&gt; Features like Coroutines. This RFC is 7 years old now.<p>We haven&#x27;t been idling around for 7 years (either on that feature or in general). We&#x27;ve added asynchronous functions (which whole ecosystems and frameworks have arisen around), traits that can include asynchronous functions (which required <i>extensive</i> work), and many other features that are both useful in their own right and needed to get to more complex things like generators. Some of these features are also critical for being able to standardize things like `AsyncWrite` and `AsyncRead`. And we now have an implementation of generators available in nightly.<p>(There&#x27;s some debate about whether we <i>want</i> the complexity of fully general coroutines, or if we want to stop at generators.)<p>Some features have progressed slower than others; for instance, we still have a lot of discussion ongoing for how to design the AsyncIterator trait (sometimes also referred to as Stream). There have absolutely been features that stalled out. But there&#x27;s a <i>lot</i> of active work going on.<p>I always find it amusing to see, simultaneously, people complaining that the language isn&#x27;t moving fast enough and other people complaining that the language is moving too fast.<p>&gt; Function traits (effects)<p>We had a <i>huge</i> design exploration of these quite recently, right before RustConf this year. There&#x27;s a challenging balance here between usability (fully general effect systems are <i>complicated</i>) and power (not having to write multiple different versions of functions for combinations of async&#x2F;try&#x2F;etc). We&#x27;re enthusiastic about shipping a solution in this area, though. I don&#x27;t know if we&#x27;ll end up shipping an <i>extensible</i> effect system, but I think we&#x27;re very likely to ship a system that allows you to write e.g. one function accepting a closure that works for every combination of async, try, and possibly const.<p>&gt; Compile-time Capabilities<p>Sandboxing against <i>malicious</i> crates is an out-of-scope problem. You can&#x27;t do this at the language level; you need some combination of a verifier and runtime sandbox. WebAssembly components are a much more likely solution here. But there&#x27;s lots of interest in having capabilities for other reasons, for things like &quot;what allocator should I use&quot; or &quot;what async runtime should I use&quot; or &quot;can I assume the platform is 64-bit&quot; or similar. And we do want sandboxing of things like proc macros, not because of malice but to allow accurate caching that knows everything the proc macro depends on - with a sandbox, you know (for instance) exactly what files the proc macro read, so you can avoid re-running it if those files haven&#x27;t changed.<p>&gt; Rust doesn&#x27;t have syntax to mark a struct field as being in a borrowed state. And we can&#x27;t express the lifetime of y.<p>&gt; Lets just extend the borrow checker and fix that!<p>&gt; I don&#x27;t know what the ideal syntax would be, but I&#x27;m sure we can come up with something.<p>This has never been a problem of syntax. It&#x27;s a <i>remarkably</i> hard problem to make the borrow checker able to handle self-referential structures. We&#x27;ve had a couple of iterations of the borrow checker, each of which made it capable of understanding more and more things. At this point, I <i>think</i> the experts in this area have ideas of <i>how</i> to make the borrow checker understand self-referential structures, but it&#x27;s still going to take a substantial amount of effort.<p>&gt; This syntax could also be adapted to support partial borrows<p>We&#x27;ve known how to do partial borrows for quite a while, and we already support partial borrows in closure captures. The main blocker for supporting partial borrows in public APIs has been how to expose that to the type system in a forwards-compatible way that supports maintaining stable semantic versioning:<p>If you have a struct with private fields, how can you say &quot;this method and that method can borrow from the struct at the same time&quot; without exposing details that might break if you add a new private field?<p>Right now, leading candidates include some idea of named &quot;borrow groups&quot;, so that you can define your own subsets of your struct without exposing what private fields those correspond to, and so that you can change the fields as long as you don&#x27;t change which combinations of methods can hold borrows at the same time.<p>&gt; Comptime<p>We&#x27;re actively working on this in many different ways. It&#x27;s not trivial, but there are many things we can and will do better here.<p>I recently wrote two RFCs in this area, to make macro_rules more powerful so you don&#x27;t need proc macros as often.<p>And we&#x27;re already talking about how to go even further and do more programmatic parsing using something closer to Rust constant evaluation. That&#x27;s a <i>very</i> hard problem, though, particularly if you want the same flexibility of macro_rules that lets you write a macro and use it in the same crate. (Proc macros, by contrast, require you to write a separate crate, for a variety of reasons.)<p>&gt; impl&lt;T: Copy&gt; for Range&lt;T&gt;.<p>This is already in progress. This is tied to a backwards-incompatible change to the range types, so it can only occur over an edition. (It would be possible to do it without that, but having Range implement both Iterator and Copy leads to some easy programming mistakes.)<p>&gt; Make if-let expressions support logical AND<p>We have an unstable feature for this already, and we&#x27;re close to stabilizing it. We need to settle which one or both of two related features we want to ship, but otherwise, this is ready to go.<p><pre><code> &gt; But if I have a pointer, rust insists that I write (*myptr).x or, worse: (*(*myptr).p).y. </code></pre> We&#x27;ve had multiple syntax proposals to improve this, including a postfix dereference operator and an operator to navigate from &quot;pointer to struct&quot; to &quot;pointer to field of that struct&quot;. We don&#x27;t currently have someone championing one of those proposals, but many of us are fairly enthusiastic about seeing one of them happen.<p>That said, there&#x27;s also a danger of spending too much language weirdness budget here to buy more ergonomics, versus having people continue using the less ergonomic but more straightforward raw-pointer syntaxes we currently have. It&#x27;s an open question whether adding more language surface area here would on balance be a win or a loss.<p>&gt; Unfortunately, most of these changes would be incompatible with existing rust.<p>One of the wonderful things about Rust editions is that there&#x27;s very little we <i>can&#x27;t</i> change, if we have a sufficiently compelling design that people will want to adopt over an edition.<p>&gt; The rust &quot;unstable book&quot; lists 700 different unstable features - which presumably are all implemented, but which have yet to be enabled in stable rust.<p>This is <i>absolutely</i> an issue; one of the big open projects we need to work on is going through all the existing unstable features and removing many that aren&#x27;t likely to ever reach stabilization (typically either because nobody is working on them anymore or because they&#x27;ve been superseded).
评论 #41655306 未加载
评论 #41655941 未加载
评论 #41658873 未加载
评论 #41656203 未加载
iTokio8 months ago
Rust mission was already a difficult mix between performance, safety and expressiveness, then the project lost its “founder mode” when Mozilla disengaged, and the original core team mostly left, so no wonder progress slowed down. I personally think that’s it’s better than going down the wrong path.
louismerlin8 months ago
If I were to rewrite Rust, I&#x27;d probably go the route of less features, not more.<p>Make it 70% of Rust in 10% of the code, similarly to what QBE[0] is doing with LLVM.<p>You&#x27;d probably be able to achieve that if you remove macros and some of the rarely-used features.<p>[0]: <a href="https:&#x2F;&#x2F;c9x.me&#x2F;compile&#x2F;" rel="nofollow">https:&#x2F;&#x2F;c9x.me&#x2F;compile&#x2F;</a>
评论 #41656370 未加载
epage8 months ago
RE: Rust&#x27;s pacing<p>I&#x27;ve had a lot of talks with my management about that. For context, I&#x27;m on the Cargo team and have authored 11 RFCs (10 approved, 1 pending).<p>I feel like a lot of the pacing feels slow because:<p>- As the project matures, polishing whats there takes up a lot of effort<p>- Conversely, hitting local maximas where things are &quot;just good enough&quot; that individuals and companies don&#x27;t feel the need to put effort to doing the last leg of work.<p>- Lack of coordinated teams (formerly Mozilla) doubling down on an idea to hash it out. Hopefully [Project Goals](<a href="https:&#x2F;&#x2F;rust-lang.github.io&#x2F;rfcs&#x2F;3614-project-goals.html" rel="nofollow">https:&#x2F;&#x2F;rust-lang.github.io&#x2F;rfcs&#x2F;3614-project-goals.html</a>) will help a little in this direction.<p>- As the project has grown, we&#x27;ve specialized a lot more, making it harder to develop a cross-team feature. It takes finesse to recruit someone from another team to help you finish out a cross-team feature. It also doesn&#x27;t help we&#x27;ve not done a good job developing the cross-team communication channels to make up for this specialization. Again, Project Goals are trying to improve this. In-person conferences starting back up has also been a big help.<p>As for RFCs, we&#x27;ve been moving in the direction of choosing the level of process thats appropriate for a decision. Unsure how something will look? You just need approval from 2 members of the relevant team to start a nightly only experiment to flesh out the idea in preparation for an RFC. In Cargo, many decisions don&#x27;t need wide input and are just team votes on an Issue. RFCs drag out when their isn&#x27;t a someone from the team shepherding it through the process, the RFC covers too much and needs to be shrunk to better focus the conversation, too much is unknown and instead an experiment is needed, or its cross-team and you need to know how to navigate the process to get the vote done (we want to improve this). As for things being approved but not completed, thats a &quot;we need more help&quot; problem usually.
评论 #41686061 未加载
jfyasdfwasdf8 months ago
Rust 2.0 wishlist:<p><pre><code> * Supports Unions (TypeScript, Flow, Scala3, Hare) * Supports GADTs * Capable of targeting both preemptive userland concurrency (go, erlang, concurrent Haskell, concurrent OCaml) and cooperative (tinygo, nodejs, async-python, async-rust) without code changes * Easily build without libc (CGO_ENABLED=0) * No Backwards compatibility promise - This eliminates geriatrics * Cleaner syntax, closer to Go, F#, or Python * Graph-based Borrow Checker * Add `try-finally` or `defer` support, `Drop` is too limiting, Async drop could help. * Fix Remaining MIR Move Optimizations and Stack Efficiency * Culture for explicit allocator passing like Zig * `.unwrap()` is removed</code></pre>
conradludgate8 months ago
I muuuch prefer pin to any move trait. Pin is a place property, not a type property. I think this post covers it nicely. <a href="https:&#x2F;&#x2F;without.boats&#x2F;blog&#x2F;pinned-places&#x2F;" rel="nofollow">https:&#x2F;&#x2F;without.boats&#x2F;blog&#x2F;pinned-places&#x2F;</a>. It definitely should be more ergonomic though
评论 #41655563 未加载
评论 #41656379 未加载
eterevsky8 months ago
I would gladly switch to a Rust fork without async. Even though this article is not about async per se, it’s clear that async makes most of the described problems worse.
评论 #41656308 未加载
评论 #41655928 未加载
hiimkeks8 months ago
I think the first three items are &quot;add effects, and do it right&quot;:<p>Capabilities to IO can be done by letting IO functions interrupt and call an effect handler, and the caller can specify the effect handler and do access control in there.<p>The whole Pin situation only exists because async&#x2F;await was an afterthought and didn&#x27;t work well with the existing language. async&#x2F;await is an instance of effects.<p>I&#x27;m excited to start playing with a language that has a good effect system. I am hoping on Ante, but would also like to try Roc at some point.
评论 #41658091 未加载
ephaeton8 months ago
&quot;Maybe I should fork the compiler and do it myself. Urgh. So many projects. If I could live a million lifetimes, I&#x27;d devote one to working on compilers.&quot;<p>-- Maybe you are living a million lifetimes in parallel right now and this one is the one devoted to working on compilers? Get to it! :-)
alkonaut8 months ago
&gt; most uses of unsafe would also require explicit whitelisting.<p>I think this is probably where all proposed whitelist&#x2F;capability proposal discussions end. It&#x27;s going to be too many crates that are in that category for it to be useful.<p>A good first step (not sure if it&#x27;s already taken tbh) would be to at least sandbox <i>build</i> execution. So that an attacker can&#x27;t execute arbitrary code when your app is compiled.
weinzierl8 months ago
It&#x27;s a good collection of the usual suspects, when it comes to suggested improvements for Rust.<p>The one point that stuck out for me is the comptime section. It approaches the topic from a security and supply-chain attacks angle, which is a way I never thought about it.
rtpg8 months ago
The function trait section reminded me about effect systems and Purescripts row polymorphism[0], which is a great little way to be able to encode properties of your functions.<p>I think Rust might quickly run into the “negative trait” problem trying to get that working, while embracing an effect system like Purescripts might get you the goods in a “principled” way. Though I haven’t thought about this deeply.<p>[0]: <a href="https:&#x2F;&#x2F;rtpg.co&#x2F;2016&#x2F;07&#x2F;20&#x2F;supercharged-types.html" rel="nofollow">https:&#x2F;&#x2F;rtpg.co&#x2F;2016&#x2F;07&#x2F;20&#x2F;supercharged-types.html</a>
maverwa8 months ago
I think there are fair complaints and good ideas in this. But I also think thats a bit hypocritical: They complain that there is a gigantic backlog of features in progress (as in &quot;not in stable yet&quot;), and then goes on to propose a lot of additional, quite fundamental and far reaching featues they&#x27;d like to see.<p>Don&#x27;t get me wrong: I&#x27;d like coroutines and a lot of other unstable&#x2F;hidden features done as well. Function traits sound great, and I&#x27;d also like the whole Pin stuff to be easier (or gone?).<p>But please, &quot;Lets just extend the borrow checker and fix that&quot; sounds very demeaning. Like no one even tried? I am by far no expert, but I am very sure that its not something you &quot;just&quot; go do.<p>I like most of the proposed features and improvements, I mostly share the critique on the language, but I do not thing the &quot;why not just fix it?&quot; attitude is helpful or warranted. Theres tons of work, and only so much people &amp; time.
评论 #41656792 未加载
评论 #41655802 未加载
uneekname8 months ago
I am relatively new to rust (only written a couple thousand lines, haven&#x27;t fully grokked &quot;idiomatic&quot; rust, etc.) and I feel like I&#x27;ve run into these and similar warts many times. It is weird to lookup, say, coroutines in Rust to learn that everyone seems to agree they should exist, but they won&#x27;t anytime soon. For a language focused on &quot;correctness&quot; and ergonomics, I think the rust community should consider some backwards-incompatible changes in the name of a better language.
评论 #41656754 未加载
culebron218 months ago
I think adding per-crate permissions to do undoable&#x2F;unsafe things will lead us to permissions hell of devops in big deployments. Like Amazon S3 with gazillion options. I think it&#x27;s time to do something radically different with 3rd party deps.<p>Even if we put aside safety issues, each crate brings ~10 more dependencies by default (i.e. without any features turned on), which bloats compile times. Maybe it&#x27;s better to be able to shard 3rd party crates, and not update them automatically at all?
评论 #41655243 未加载
olivierduval8 months ago
&gt; Most crates I use - like human-size or serde don&#x27;t need any special capabilities to work. So we don&#x27;t need to worry so much about their authors &quot;turning evil&quot; and adding malicious code to our software<p>well... :-(<p>Actually, it&#x27;s obvious that some authors might &quot;turn evil&quot; dumbly, by abusing some kind of priviledged permissions. By chance, these kinds of supply-chain risks are &quot;easily&quot; identified because<p>1) the permissions are an &quot;easy&quot; risk indicator, so you can priorize either to pin the version library (after validating it) or validate the new version<p>2) not so many libraries will use these permissions so you &quot;have time&quot; to focus on them<p>3) in these libraries, the permissions will tell you what system call&#x2F;bad effects is possible, so will allow you to narrow even more the scope of investigation<p>So, IMHO, permissions are not really the end of all but only a tiny step.<p>The real problem is &quot;how can human-size be used to subvert the program ?&quot; For example: what is happening if the returned size &quot;forget&quot; or &quot;add&quot; 100 bytes to files bigger than 1 KB ? As a remininder, STUXNET was about some speed a tiny bit faster than planned and shown...
评论 #41656249 未加载
评论 #41655332 未加载
tommiegannert8 months ago
&gt; Rust doesn&#x27;t have syntax to mark a struct field as being in a borrowed state.<p>&gt; ast_nodes: Vec&lt;&amp;&#x27;Self::source str&gt;,<p>Oh, that would be neat to replace the <a href="https:&#x2F;&#x2F;github.com&#x2F;tommie&#x2F;incrstruct">https:&#x2F;&#x2F;github.com&#x2F;tommie&#x2F;incrstruct</a> I wrote for two-phase initialization. Unlike Ouroboros and self_cell, it uses traits so the self-references can be recreated after a move. Whether it&#x27;s a good idea, I don&#x27;t know, but the magic Ouroboros applies to my struct feels wrong. But I say that as someone coming from C++.<p>&gt; if let Some(x) = some_var &amp;&amp; some_expr { }<p>Coming from Go, I was surprised that something like<p><pre><code> if let Some(x) = some_var; expr(x) { } </code></pre> isn&#x27;t a thing.
评论 #41655942 未加载
评论 #41657225 未加载
binary1328 months ago
When I look at the way C++ has been developed and implemented over the years, I can’t help but think that a relatively small and questionably sustainable group of compiler engineers, no matter how passionate (and people do burn out) cannot possibly hope to sustain development of Rust indefinitely, especially as the project’s complexity and convolutions continue to further complicate and convolve. The only reason C++ has been able to is that it has very extensive industrial sustenance behind at least two of its major compilers, and presumably they also help keep GCC up to par. I don’t know, maybe GCC can somehow set the standard for what Rust can hope to do over the years, but it seems like a minor miracle from the outside.
dietr1ch8 months ago
Marking fixed stack size (and maybe even with an actual bound) would be helpful to ensure the tail-call optimisation is being done.<p>I don&#x27;t think any language helps verifying that., and even in the ones that require it by spec, it&#x27;s unclear if it&#x27;s happening. Maybe you didn&#x27;t really wrote a tail-recursive function because of a helper that you expected to be inlined. I guess it&#x27;s easy to notice if you try to blow the stack in a unit test though.
评论 #41656147 未加载
评论 #41656394 未加载
FrustratedMonky8 months ago
&quot;the coroutines RFC has lasted longer than World War 1 or 2&quot;<p>This sounds bad, but I wonder how many features have taken this long to include in other languages. Is this really as out of step as it sounds?<p>There is the move-fast-break-things mentality, but is that how you want to design a language?<p>Seems like we are missing some middle ground step, where there are good features, maybe even done, and stable, but they aren&#x27;t getting worked into the main language.<p>Maybe a decision making problem.
OnorioCatenacci8 months ago
From the examples he&#x27;s mentioned, it sounds like there&#x27;s quite a bit of [bike shedding] (<a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Law_of_triviality" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Law_of_triviality</a>) in the process for RFC&#x27;s in Rust. That&#x27;s a problem when you&#x27;ve got lots of smart people trying to help.
smolder8 months ago
I hate to say it since I&#x27;m generally against this kind of obstructive elitism, but I think that maybe one of the good things about rust is it&#x27;s user-unfriendliness to amateurs. It has massive utility and ergonomy inherent to its design, but gatekeeping to keep away &quot;left-pad&quot; library authors and users is good for utility, too.
mwcampbell8 months ago
&gt; a fully baked language - warts and all. Python 2.7 for life.<p>I still wish the Python core team had abandoned the Python 3 experiment and gone with Python 2.x for life, warts and all. I learned to work with the warts, including the Unicode ones. I think a lot of us did.
bli9405058 months ago
&gt;And I don&#x27;t know if it will ever be there. Progress on the language has slowed so much. When I first started using it, every release seemed to add new, great features in stable rust. Now? Crickets.<p>Is frustration with Rust on the rise? I just started using Rust few month ago and absolutely love it. I can&#x27;t tell what&#x27;s going on with the Rust foundation so I can only judge by reading sentiments. Nothing would kill my vibe harder than knowing smart people thinks the language isn&#x27;t doing great :(
评论 #41655232 未加载
评论 #41655191 未加载
评论 #41655248 未加载
评论 #41655296 未加载
评论 #41655432 未加载
评论 #41655238 未加载
评论 #41655188 未加载
评论 #41656300 未加载
评论 #41655261 未加载
评论 #41655177 未加载
评论 #41655362 未加载
csomar8 months ago
&gt; You can&#x27;t tell that something is borrowed until you try to compile your program. (Aside: I wish Rust IDEs made this state visible while programming!)<p>I am not sure what the OP is using, but with LSP I do get the error message in my editor (nvim) before any compiling (though am pretty sure some checking in happening in the background).<p>&gt; Compile-time Capabilities<p>Not sure how this makes any sense when Rust compiles to multiple targets. Should all libraries become aware of all the &quot;capabilities&quot; out there. Also, this already can be implemented using features and keep things minimal.<p>&gt; Comptime<p>I can&#x27;t make sense of what the OP issue is here.<p>&gt; Make if-let expressions support logical AND. Its so simple, so obvious, and so useful. This should work: if let Some(x) = some_var &amp;&amp; some_expr { }<p>The example makes no sense.
johan_felisaz8 months ago
The section on comp time is written in a way which makes you think that zig invented the concept. It slightly irritated the lisper in me...<p>Great article apart from that.
评论 #41656409 未加载
gavinhoward8 months ago
I explain how Rust missed the mark in [1].<p>[1]: <a href="https:&#x2F;&#x2F;gavinhoward.com&#x2F;2024&#x2F;05&#x2F;what-rust-got-wrong-on-formal-verification&#x2F;" rel="nofollow">https:&#x2F;&#x2F;gavinhoward.com&#x2F;2024&#x2F;05&#x2F;what-rust-got-wrong-on-forma...</a>
tskulbru8 months ago
Article aside, that page background messed with eyes while reading
评论 #41655146 未加载
评论 #41656410 未加载
评论 #41655138 未加载
Avi-D-coder8 months ago
yep,i agree on all of this and suspect a large portion of long timers do too.<p>Some one just has to do it.
nikolay8 months ago
If functions are &quot;fn&quot;, then coroutines should be &quot;co&quot;. In terms of verbosity, Rust turned into Java.
adastra228 months ago
Do it! I’d use this language.
sam0x178 months ago
These are actually great and I would gladly welcome these changes if they were implemented in stable.<p>My wishlist:<p>* allow const fns in traits<p>* allow the usage of traits in const exprs. This would allow things like using iterators and From impls in const exprs, which right now is a huge limitation.<p>* allow defining associated type defaults in traits. This can already be worked around using macros somewhat effectively (see my supertrait crate) but real support would be preferable.<p>* allow eager expanding of proc macro and attribute macro input, perhaps by opting in with something like `#[proc_macro::expand(tokens)]` on the macro definition. Several core &quot;macros&quot; already take advantage of eager expansion, we peasants simply aren&#x27;t allowed to write that sort of thing. As a side note, eager expansion is already possible for proc and attribute macros designed to work _within proc macro crates_, for example this which I believe is the first time this behavior was seen in the wild: <a href="https:&#x2F;&#x2F;github.com&#x2F;paritytech&#x2F;substrate&#x2F;blob&#x2F;0cbea5805e0f4edcf8a3a70135b4d8eabc2db06f&#x2F;frame&#x2F;support&#x2F;procedural&#x2F;src&#x2F;lib.rs#L971-L982">https:&#x2F;&#x2F;github.com&#x2F;paritytech&#x2F;substrate&#x2F;blob&#x2F;0cbea5805e0f4ed...</a><p>* give build.rs full access to the arguments that were passed to cargo for the current build. Right now we can&#x27;t even tell if it is a `cargo build` or a `cargo doc` or a `cargo test` and this ruins all sorts of opportunities to do useful things with build scripts<p>* we really need a `[doc-dependencies]` section in `Cargo.toml`<p>* give proc macros reliable access to the span &#x2F; module &#x2F; path of the macro invocation. Right now there are all sorts of projects that hack around this anyway by attempting to locate the invocation in the file system which is a terrible pattern.<p>* allow creating custom inner attributes. Right now core has plenty of inner attributes like `#![cfg(..)]` etc, and we have the syntax to define these, we simply aren&#x27;t allowed to use custom attribute macros in that position<p>* revamp how proc macro crates are defined: remove the `lib.proc-macro = true` restriction, allowing any crate to export proc macros. Facilitate this by adding a `[proc-macro-dependencies]` section to `Cargo.toml` that separately handles proc-macro-specific dependencies. Proc macros themselves would have access to regular `[dependencies]` as well as `[proc-macro-dependencies]`, allowing proc macro crates to optionally export their parsing logic in case other proc macro crates wish to use this logic. This would also unblock allowing the use of the `$crate` keyword within proc macro expansions, solving the age old problem of &quot;how do I make my proc macro reliably refer to a path from my crate when it is used downstream?&quot;<p>* change macro_rules such that `#[macro_export]` exports the macro as an item at the current path so we can escape from this ridiculousness. Still allow the old &quot;it exports from the root of the current crate&quot; behavior, just deprecate it.
bilekas8 months ago
Seems rust has come full circle. Rewriting everything in rust.. Why not Rust! &#x2F;s
评论 #41658285 未加载
raverbashing8 months ago
You know, I agree<p>And there&#x27;s a lot of things that are weird or clunky<p>I honestly don&#x27;t &quot;get&quot; the &quot;no classes, just struct methods thing&quot; and while, sure, C++ is kinda like that, but the ergonomics are weird. I&#x27;d much rather have the class&#x2F;methods declaration as most languages do<p>Lifetimes are good but the implementation is meh. Most cases could do with a default lifetime.<p>Copy&#x2F;borrow strictness is good to think about but in most cases we don&#x27;t care? Copy should probably the default and then you borrow in special cases
LetMeLogin8 months ago
I stopped reading at &quot;Like the first iPhone - which was amazing by the way.&quot;<p>That phone couldn&#x27;t even send MMS.... You had to jailbreak it to be able to do normal stuff that the phones could do for ages back then.
Havoc8 months ago
The drama around rust leadership and also in kernel has me more spooked tbh. It’s more of a threat to the long term viability of the lang. Flaws in a language are to some extent expected and can be worked around.<p>Languages like C++ and python are wildly successful and don’t think anyone would call them perfect.<p>The dependence point is valid but not sure that is easily solvable in general. Doesn’t seem like a rust issue. See npm and python pip - blind trust is par for the course except in very rigorous environments