HNHacker News
TopNewBestAskShowJobs

tatterdemalion

2,029 karma · joined July 31, 2014

https://github.com/withoutboats
submissionscomments
tatterdemalion··on Rob Pike's Rules of Programming (1989)
Fortunately there are many languages which will provide a generic abstraction for you, so you don't have to deal with any of the complexity of implementing a hash set and you can just treat it like a set.
tatterdemalion··on Go vs. Rust? Choose Go
> Rust has the complexity of C++ plus additional complexity from the functional community. Plus lots of fancy template cruft.

This is so patently false. C++ contains an order of magnitude more complexity than Rust (as one would expect for a language that continues to evolve radically 30+ years after it was designed; for better or worse, complexity is C++'s game).

tatterdemalion··on Announcing Rust 1.20
Yes of course (I work on Rust). I mean that the difference between f32::NAN and std::f32::NAN is a small convenience.
tatterdemalion··on Announcing Rust 1.20
The consts are currently defined in modules with the same name as the type, `std::f32::NAN;`. This feature allows them to be associated with the type itself - `f32::NAN`. A small convenience.
tatterdemalion··on Announcing Rust 1.20
Associated consts allows constants to be derived from our trait-constrained parametric polymorphism. C++ currently has no analog to this system (templates can be used, but don't provide a constraint system; concepts are not in C++17 afaik).

At an introductory level, like this announcement, we teach this system by analogy to OO, but its not OO in its core and snide comments like this only reveal the limits of your knowledge.

tatterdemalion··on A Theory of Jerks (2014)
This doesn't do anything at all to resolve the ambiguity in this sentence.
tatterdemalion··on Researcher Who Stopped WannaCry Ransomware Detained in US After Def Con
That's the problem.
tatterdemalion··on Rust: Not So Great For Codec Implementing
Then you have to do a deep clone every time. Arc<Vec<u8>> is also not sufficient, because Bytes lets you share a reference count among slices to different offset into the buffer.
tatterdemalion··on Rust: Not So Great For Codec Implementing
Bytes is intended for use with the tokio ecoystem where you cna't use references often because borrowing across a yield point in a future would be a lifetime error.
tatterdemalion··on Announcing the `http` crate
Parsing would get into policy choices this crate doesn't want to make, like DoS protection (max request size, mid-request timeouts, etc), and often is intertwined with reading data from IO, which this crate definitely doesn't want to get involved in.
tatterdemalion··on Announcing Rust 1.19
Want to echo this part:

> nobody has put in that work to come up with a proposal.

Features like this mainly need a champion who really cares about getting it into the language & can work with the language & compiler teams to complete that process.

tatterdemalion··on RFC: Evolving Rust Through Epochs
That's not correct. cargo will fail to resolve your dependencies if that happens.

For example (cargo_metadata 0.2.1 depends on serde ^1.0.2):

    [dependencies]
    serde = "=1.0.0"
    cargo_metadata = "0.2.1"
Attempting to cargo fetch will result in this error message:

    error: failed to select a version for `serde` (required by `cargo_metadata`):
    all possible versions conflict with previously selected versions of `serde`
This is an intentional design decision in cargo that isn't well known.
tatterdemalion··on RFC: Evolving Rust Through Epochs
Other people have addressed the question about epochs, but I'd also note that we do work to mitigate the code bloat issues of multiple versions of libraries. cargo is designed to unify all dependencies on a library within each major version to a single instance (that is, you'll never build serde-1.0.0 and serde-1.1.0 together, but you may build serde-1.0.0 and serde-2.0.0).
tatterdemalion··on Bugs You'll Probably Only Have in Rust
Your "IIUC" is just a restatement of the sentence you quoted.

You understood the bug correctly, but its not a bigger problem. You probably are lacking context on auto traits, but this blog post contains the context you need if you read it again.

tatterdemalion··on Bugs You'll Probably Only Have in Rust
> Go also has zero-sized types (struct{}), so I wonder if this is also possible?

No. It specifically uses Rust's generics system, and the fact that generics are monomorphized at compile time, whereas Go interfaces are not.

C++ templates can be used in similar ways.

tatterdemalion··on Rust Performance Pitfalls
A Sufficiently Smart Compiler would be able to.

The second just increments a pointer which starts at the first elem of the array; the first increments a counter and then uses it as an offset into the array, which is bounds checked (the second never generates bounds checks). Proving that that counter never exceeds the end of the array, so the bounds check can be dropped, is not trivial.

tatterdemalion··on Rust: A Scala Engineer's Perspective
What's overblown in my opinion is the treatment of "functional" or "object-oriented" programming as a feature of languages and not programs (though certain languages definitely make it easier).

I've never found a better explanation of the real ontological differences between these paradigms than this section at the end of chapter 3 of SICP: https://sarabander.github.io/sicp/html/3_002e5.xhtml#g_t3_00...

> We can model the world as a collection of separate, time-bound, interacting objects with state, or we can model the world as a single, timeless, stateless unity. Each view has powerful advantages, but neither view alone is completely satisfactory. A grand unification has yet to emerge.

tatterdemalion··on Two years of Rust
Yes, thats what the second point is.
tatterdemalion··on Two years of Rust
> Is the Rust community claiming that the entire history of computing has lead up to this point, where Rust exists, and now nobody needs to write anything in not-Rust? Are people 200 years from now going to write Rust and nothing else?

Let's be clear - the person who said there'd be no reason to write in anything else is an enthusiastic Rust user, but they don't work on Rust & don't represent "the Rust community." They were speaking from their own experience, based on their own balancing of the trade offs as a user. Presumably a REPL doesn't rate very highly for them.

However, the reasons we don't have a REPL are mainly two: the compiler isn't architected for it and code doesn't compile fast. The solutions are:

* Re-architect the compiler to support incremental code input. This is pretty similar to what we need to support IDEs (which we're working on), so possibly this will solve the problem.

* Get a reimplementation of the backend which is a JIT interpreter instead of LLVM, which takes up most of our compiletime. Work is underway on a project called miri, though it isn't officially supported right now.

* Make the typechecking part of the compiler faster. This is underway through a project called chalk.

In other words, a REPL is not impossible, it just isn't a top priority right now. There are other lacking tools that we're working on - IDE integration and auto-formatting for example - maybe after those are done it will be the top of the docket.

tatterdemalion··on Two years of Rust
I think we all agree that future chaining isn't great surface API in the long-term, but we have a pretty good idea of how to desugar async/await to the futures we have. That's why we're build the runtime around them; because they're fast and they will (someday) have a relatively convenient API.
tatterdemalion··on The Pain of Real Linear Types in Rust
Its hard for me to imagine that requiring every value to be explicitly dropped would produce code which is easier to read and understand.
tatterdemalion··on I Broke Rust's Package Manager for Windows Users
There is a very long comment in the cargo source which explains this decision and some of the trade offs involved. https://github.com/rust-lang/cargo/blob/master/src/cargo/sou...

I know that some of the people who worked on cargo originally had experience with other package managers - mainly bundler - and I believe bundler used to use a single file, but ran into performance issues.

tatterdemalion··on I Broke Rust's Package Manager for Windows Users
As the blog post mentioned, we solve the issue by deleting the crate from the package repository and reserving these problematic names. The incident lasted about 2 and a half hours.

Crate names have to be one or more valid idents connected by hyphens, so no other clever names like `/home` would be possible to upload. We already had some crate names reserved and we just needed to add these to the list.

tatterdemalion··on Rust 1.17
Might be that, might also be that SliceConcatExt only had connect in 1.2, not join.
tatterdemalion··on Rust 1.17
Both of these errors are reproducible with the 1.2 compiler, but not with the 1.17 compiler. Most likely this user believed they were compiling with 1.17 but they were compiling with 1.2.
tatterdemalion··on Rust 1.17
TL;DR Animats's errors were attempting to compile code from a more recent version of Rust on 1.2, or something similar. When I attempted to reproduce, I got the same errors on 1.2, and no errors on 1.17. Rust does not guarantee forward compatibility, code that compiles on 1.17 will not necessarily compile on 1.2 (of course, that would mean no new features).

I attempted to reproduce your report by downloading the 1.2 compiler and compiling this code in both versions. Here is what I got:

---

First, the Vec.join report. I attempted to compile a crate with this body on both versions:

    fn main() {
        let v: Vec<&str> = vec!["hello, ", "world"];
        v.join("");
    }
On 1.2 this failed to compile with exactly the error you stated. This isn't surprising to me since I recall us adding .join to Vec several months after the 1.2 release. So you certainly weren't compiling that code on 1.2.

In contrast, on 1.17, this code compiled just fine. This is exactly what I expected, since I use vec.join all the time on vectors of string slices.

In conclusion, I was unable to reproduce this bug.

---

Second, the Cargo star dependencies report. Manishearth is wrong, we disallow those dependencies from being uploaded to crates.io, but end users are allowed to use them just fine (strongly recommended that you don't, though!).

To attempt to reproduce, I built a crate with this dependencies section:

    [dependencies]
    chrono="*"
On 1.2, I got exactly the error you stated. I don't know what the source of it is, but I know that star dependencies are risky because they imply indefinite forward compatibility, which is impossible to guarantee.

On 1.17, this successfully resolved to the 0.3.0 version of chrono, which compiled just fine.

Once again, I was unable to reproduce your bug report.

---

If you have any more bug reports, please post them on https://github.com/rust-lang/rust . And you can check which version of the compiler you're using with `rustc --version` (supported since before 1.0).

tatterdemalion··on Rust Language Server Now Available with Rustup
I wonder if this might not be a good opportunity to rethink your strategy of finding some trollish snark to comment on every post about Rust.
tatterdemalion··on Rust's Type System Is Turing-Complete: Type-Level Programming in Rust
This example code must be monomorphized at compile time, meaning that each closure will have a different representation. "Tail call optimization at the type level" is not possible with this compilation model.

(The problem is solved by using a trait object to dynamically dispatch the inner call. https://play.rust-lang.org/?gist=0d3c0a5f1291eb34ba61bd39449...)

tatterdemalion··on Rust's Type System Is Turing-Complete: Type-Level Programming in Rust
In the near future, Rust's trait system literally will be a logic language similar to Prolog that runs at compile time. We walk the AST and generate statements to prove. This is expected to be easier to reason about, to be easier to extend, and to have shorter compile times - for essentially the reason you cite. Its even given us some (as yet unexplored) ideas for new extensions.
tatterdemalion··on Rust's Type System Is Turing-Complete: Type-Level Programming in Rust
Hey I'm the person who raised the question (and I work on Rust, mainly on the trait system discussed in this post).

I agree with the author that while this is interesting, for users it doesn't matter much. In particular, the folks (with respect) pontificating about whether this is a good or bad thing are quite exagerating its consequences. In practice, you can neither conveniently use this property for metaprogramming, nor will you ever get a nonterminal typechecking (not only is there a recursion limit, it is extremely unlikely you will write the kinds of impls that hit that limit except in extreme typelevel programming like documented here).

The most interesting thing is that the two examples we have now of turing completeness both use only features available in Haskell without making typechecking undecidable. The reason our system is Turing complete is that we allow certain impls that Haskell wouldn't, which are in practice very useful.

For example, we have an impl of "ToString for T where T: Display" (in Haskellese "instance Display a => ToString a"); that is, anything that can be pretty printed also has a to_string method. This would be disallowed without the -XUndecidableInstances flag in Haskell. However, if your type can't be pretty printed, you can separately add a ToString impl for it (even with undecidable instances, Haskell wouldn't consider this coherent because Haskell coherence ignores constraints).

If you're interested, the exact sorts of impls we allow that Haskell wouldn't are covered by what's called the "Paterson condition" in Haskell docs.

← PreviousPage 2 of 14Next →