Live data from Hacker News

The Rust I wanted had no future

graydon2.dreamwidth.org

81–90 of 523 posts

Re: The Rust I wanted had no future

#81

I’m very glad expressivity won out. I would like our profession to stop accepting tools that waste effort. I’ve always seen safety and lifetimes and borrowing as the main value prop, so I was surprised to see he was sort of aiming at an ML without GC, rather than a C++ that doesn’t blow up.

Early rust did have gc so it was more of an ML with optional gc, and maybe a dot operator. (And no closures apparently)

Re: The Rust I wanted had no future

#82

> Tail calls. I actually wanted them! I think they're great. And I got argued into not having them because the project in general got argued into the position of "compete to win with C++ on performance" and so I wound up writing a sad post rejecting them I don't understand the subtleties here: Is tail calls an optimization the compiler can do irrespective of the language? Or is there something that prevents this and…

It’s about stack size. Programs that rely on tail calls (in particular recursive ones) may cause the stack to overflow when the language implementation doesn’t actually support tail calls, for example when using tail calls to recursively process a list that is larger than (some constant fraction of) the stack. With an infinite stack, it would just be an optimization, but in practice the stack is finite (and significantly smaller than the heap), and thus doesn’t lend itself to such a programming style when the implementation doesn’t support tail call optimization.

Re: The Rust I wanted had no future

#83

This is an interesting read, because I read it as "I would have done all these things which would have kept the language more pure to my vision but less accessible". I also found this bit interesting: "It's easier to work with than C++, but that's fairly faint praise". I see this kind of thing in my own personal projects all the time. I'm thinking "oh it would be really cool if I built X" when in reality most of the…

I'm not sure it would be less accessible. I think the trade-offs would lean towards simplicity, and perhaps less familiarity. But with the right mental models, I think this could enhance accessibility (less "magic", or strange edge-cases). For example, see the discussion on not minding if users have to write something in a more verbose way if it preserves the language's principles. This type of trade-off is something…

I'm using accessible in a very general sense. The sense of "how niche would this be". My impression is that Rust would have been a very niche language if Graydon was the BDFL.

Re: The Rust I wanted had no future

#84
> The priorities I had while working on the language are broadly not the revealed priorities of the community that's developed around the language in the years since

Isn't that a matter of self selection? A language which developed around those priorities would have a community sharing those priorities now.

The point is if that community would be as large as the current one, larger, smaller.

Re: The Rust I wanted had no future

#85

Earlier quoted context omitted.

> it may become less attractive for other use cases. For instance, I find it highly questionable to develop a web app in Rust... I mean who'd want to and why bother trying to support that use case? Basically none of Rust's value proposition exists for a web app while nearly every single one of the downsides do.

Hard disagree. Rust brings a lot to the table for a web app. Compiled vs interpreted makes it easier to catch (syntax) errors beforehand. You can even go as far as compiled templates. Mapping JSON (or whatever) to strongly typed objects is great . Dependency management is best in class. I rather like diesel.rs (although it is very much an acquired taste) especially if you treat it like a safe query builder rather tha…

Although all of those things are true, I think the main point being made is why choose Rust for that, instead of Go, .NET, etc, any of which offer everything you've outlined as being worth having, while having fewer of the downsides of Rust.

Re: The Rust I wanted had no future

#86

Earlier quoted context omitted.

Not knowing about function coloring is a stupid dream and has terrible implications on the performance of your code, which is infinitely more important than you losing 2 minutes having to figure out that you really want to `runBlocking { callThatBlocksForADamnLongTime() }`. The insight that function coloring gives you is terribly important. Roman Elizarov (of Jetbrains, author of Kotlin and lead on Kotlin Coroutines)…

Async doesn't solve that problem. What you're asking for is some sort of expression in the type system of expected performance, but there's no tech that can do this. Consider that modern NVMe SSDs can do disk reads faster than many calculations over the content of what was just read. A function that changes its algorithm to have worse time complexity won't be marked as async but could break your app, adding a single…

Adding a disk read won't break my software, but it can certainly make my software non-portable. If it suddenly expects a disk write and I'm running on a ROM, I'm going to have a hard time. If it suddenly tries to contact google.com and I'm on an airgapped machine, I'm going to have a hard time. It's not even a matter of breaking the app actually, it's a matter of warning that "I'm going to go outside the realm of just your CPU and your memory". Sure, you could also mark as as async a function that adds two numbers. It's stupid, it's a JS thing to do, but you could. Except that you need to actively opt-in to being async in this case, as opposed to have it be forced upon you because you used a function that is also async.

Blocking has meaning in a lot more contexts, and being a consultant on JVM related topics, you should know that: it's the entire purpose of Project Loom, and Loom doesn't entirely get rid of colour coding either explicitly for that purpose. Loom wasn't made because the guys at Oracle have a deep love for JavaFX, but rather takes into account the server world, where you really want to know that you're going into another context, another computer, etc. The only time where the existence of async doesn't make sense is if your entire language and ecosystem expects everything to already be distributed. In which case, you've just switched the default color to async.

Finally, you chose to read async as the current JS/C# abomination implementation, but most of the sensible languages have implemented it as an effect: Kotlin has suspend funs, they don't return a Promise, but they tell you two things: they're going to touch something like the disk or the network, and if you really want to have them in a non-suspend context, you can either get a Deferred out of them (and find another thread to run it on, and handle synchronization yourself), or run them on the current thread (and block everything).

Re: The Rust I wanted had no future

#87

Earlier quoted context omitted.

Importing a trait into scope can silently materialize methods on other types, with no syntax at the method call site pointing to which import statement created the methods, requiring you to ask the compiler/IDE. This can also mean that removing a use statement with no references to the type being used in the entire rest of the source file, can make code suddenly stop compiling. I've worked around this by strictly con…

There's worse. When your trait adds function foo and your code does obj.foo(), if the underlying type later adds a foo method, compilation breaks. This is very common with traits that usefully add useful methods that are missing in libstd... which break when said method is finally added there.

I ran into this case yesterday, for some cases there are warnings now. In this case I used ".div_ceil(...)" from from the Num [0] crate.

   (some_integer).div_ceil(&2)
                  ^^^^^^^^

    = warning: once this associated item is added to the standard library, the ambiguity may cause an error or change in  behavior!
    = note: for more information, see issue #48919 
    = help: call with fully qualified syntax `num::Integer::div_ceil(...)` to keep using the current method
    = note: `#[warn(unstable_name_collisions)]` on by default
[0]: https://crates.io/crates/num

Re: The Rust I wanted had no future

#88

The article starts with "In a recent podcast about Rust leadership, the BDFL question came up again" What it BDFL?

A euphemism for a software project dictator where the moral superiority is baked into the title. The dictator does not have to be benevolent in practice.

Re: The Rust I wanted had no future

#89
post #84

> The priorities I had while working on the language are broadly not the revealed priorities of the community that's developed around the language in the years since Isn't that a matter of self selection? A language which developed around those priorities would have a community sharing those priorities now. The point is if that community would be as large as the current one, larger, smaller.

The fact that the community that formed trended in that way can be taken as an indication that those directions attracted more people than the original vision. Note how often Graydon was basically outvoted on design decisions. It would have been conceivable for the project to attract mostly people that fully shared Graydon’s vision, but that’s apparently not what happened.

Re: The Rust I wanted had no future

#90
> First-class &

Interestingly like Graydon suggests this and 'tis something D has, you can only have `ref` for function parameters. This is something the users sometimes complain about, but I guess it has positives.

Post reply on HN