HNHacker News
TopNewBestAskShowJobs

tatterdemalion

2,029 karma · joined July 31, 2014

https://github.com/withoutboats
submissionscomments
tatterdemalion··on Rust's language ergonomics initiative
In the standard library today, there's no bounds on `K` on the definition of HashMap, only on the impl block containing its methods. This sort of makes HashMap a bad example for this code block; you're right that if the bounds were on the definition instead of the impl, the argument itself would be invalid.
tatterdemalion··on Rust's language ergonomics initiative
You want textual macros. Rust doesn't have this feature, it has a syntactic macro feature inspired by the Lisp family. Sorry.
tatterdemalion··on Rust's language ergonomics initiative
DatatypeContexts turns on a feature that Rust already has - constraints on type parameters to datatypes. This is about propagating constraints from the datatypes to functions over it.

Haskell hasn't found DatatypeContexts very useful, but Rust has. In my opinion this is largely because of the difference in what our type systems mean - in Rust, types carry a lot more information about the memory model & data layout than in Haskell. This has led to a different skew.

In Haskell, DatatypeContexts also create struggles with higher kinded polymorphism (you can't implement Functor for the definition of Set you just provided, for example), but in Rust, the same memory model concerns that make datatype constraints useful make traits like Functor less useful.

tatterdemalion··on Rust's language ergonomics initiative
We use crater to check potentially breaking changes against our entire package ecoystem, but its not as easy to test which of two syntaxes for a new feature will be easier to use by looking at existing code.
tatterdemalion··on Rust's language ergonomics initiative
When we're trying to balance a trade off, I often wish we could just do A/B testing on it, but that's not realistic for languages.
tatterdemalion··on I am an Uber survivor
You should put your reputation on the line when you make such vile comments.

Your profile says you're the "technical founder on a bootstrapping startup," I want to make sure I never use your product, do business with your company, or take calls from your recruiters.

tatterdemalion··on Rust's 2017 Roadmap
> Oh, I guess the case of this I encountered most recently was actually Option<String> == Option<&str>.

There are pretty rough type inference issues preventing this impl from existing. Too many people are doing `opt == None` & the compiler would no longer be able to infer the type of None. (You should not be one of them, just call `is_none()` instead)

I'd like to see this impl some day but its not clear how to make it happen.

tatterdemalion··on What Rust Can Do That Other Languages Can't
That wasn't meant as a critique per se, the only thing that's your mistake (rather than a paucity of APIs) is the into_owned bit, and we want to deal at the language/std level with a lot of the common cases where type errors misdirect you into "into_owned"ing things.
tatterdemalion··on What Rust Can Do That Other Languages Can't
Maybe, recognizing that your vantage point is not absolute & people who disagree are not just miscreants leading the flock astray, you shouldn't be "quite concerned" that other people had a different experience using a tool than you & express that.
tatterdemalion··on What Rust Can Do That Other Languages Can't
It may surprise you to learn that I was already aware of all of the languages you mentioned, and yet I still asserted that Rust gave you more than just performance.

I specifically asserted that Rust is capable of typing imperative code in a way that no other language is. ML-descended languages hide their imperative components behind Cells and Monads. Imperative languages have type systems which don't capture questions of ownership, aliasing, and shared mutability.

I found your comment to be not at all enlightening; all you've done is list other languages with type systems and then assert that I am wrong, suggesting you read my comment with a closed mind - in which case, why comment?

tatterdemalion··on What Rust Can Do That Other Languages Can't
It seems like you're using the url crate but a different version from what I have docs for (the path() method I see doesn't return an iterator). But I believe that some of those conversions are not optimally necessary.

Definitely the into_owned is unnecessary and could be replaced by an & before `percent_decode`. This ownership wrangling is something we'd like to address in the coming year.

Then I'm not sure about percent_decode. I think there could be a better convenience for that back and forth casting between utf8 and bytes that's going on.

The only real decision you're making here is decode_utf8_lossy vs decode_utf8. I'd like to think this could be encapsulated as two methods on the Url type.

tatterdemalion··on What Rust Can Do That Other Languages Can't
I think a key fact about this example is that `&Y` is just another type of value which can be used like any other; if you can't return it our put it in a vector or whatever its really not comparable.
tatterdemalion··on What Rust Can Do That Other Languages Can't
All due respect, but I would be extremely surprised to learn that this feature is as capable as Rust's lifetime system. Whiel you've shown that you can't have an escaping reference to a local variable, what Rust provides goes far beyond that. You can return the references to Y (for example if your function has a reference to X as an argument), you can store them in the heap, you can reassign them to be references to different Ys, etc, all so long as the Ys they point to live longer than they do.
tatterdemalion··on What Rust Can Do That Other Languages Can't
You're not wrong. I think the reality is that the design patterns for using Rust are still emerging from our shared experience; trying to write that sort of book would be putting the cart before the horse.
tatterdemalion··on What Rust Can Do That Other Languages Can't
You are correct, you essentially never need to manually free memory.
tatterdemalion··on What Rust Can Do That Other Languages Can't
While obviously no type system can prevent all logic errors, an expressive type system is very valuable to avoiding these kinds of errors (in my opinion more valuable than the loss of overall expressiveness types imply, but that debate is a can of worms and YMMV).
tatterdemalion··on What Rust Can Do That Other Languages Can't
Fortunately the number of businesses that have to value correctness, craftmanship, safety, or performance over 'moving fast and breaking things' is not that high in order for Rust to succeed. I would agree that it will always be a language in the minority, but I think the industry is moving in an increasingly pluralistic direction as regards programming languages & that (nearly) all languages will be minority languages.
tatterdemalion··on What Rust Can Do That Other Languages Can't
My rough approximation is that the difference between a sound type system and an unsound type system is that a sound system rejects some valid programs and unsound system accepts some invalid ones.
tatterdemalion··on What Rust Can Do That Other Languages Can't
Indeed! I don't believe that there are tools with a lower learning curve that solve the same problem Rust does - in particular my belief is the way that Rust is able to perform deep type analysis on imperative code (which is really what the dreaded borrow checker is all about) enables proficient users to write well-factored systems with a high degree of confidence in their correctness.

If you want to onboard people to your code base with no familiarity with the language or your system and have them be 'productive' (for some definition of productive) within the week, Rust is probably not the right choice for you. In my experience projects for which that is a high priority (and the languages which enable them) also deal with a great amount of technical debt.

tatterdemalion··on What Rust Can Do That Other Languages Can't
Please read my comment more carefully. My argument has nothing to do with safety, and flippant replies are quite rude.

> I believe that the rules of Rust not only give you exceptional performance without memory issues (as this article tries to demonstrate), but also that its rules engender a higher degree of correctness and 'well-factoredness' than most languages. I believe Rust is an excellent language for writing applications at every level of the stack when 'craftmanship' matters.

tatterdemalion··on What Rust Can Do That Other Languages Can't
I am a volunteer who works on Rust & I do almost all of my open source work in Rust. I am paid as a Ruby web developer. I personally have little interest in systems programming & want Rust to be a productive language for application development.

I frequently witness this rush to judge Rust as too complex to be used for business applications based on a few hours of hacking. For this to be a valid judgment, I would think one of two things would need to be true: a) Rust remains this difficult to use once you have experience with it, or b) most business applications are worked on for only a few hours.

In my experience, neither of those premises hold.

I believe that the rules of Rust not only give you exceptional performance without memory issues (as this article tries to demonstrate), but also that its rules engender a higher degree of correctness and 'well-factoredness' than most languages. I believe Rust is an excellent language for writing applications at every level of the stack when 'craftmanship' matters.

tatterdemalion··on What Rust Can Do That Other Languages Can't
I don't know much about the Go compiler internals, but it sounds like in most cases (possibly all) the object being referenced in that way will be heap allocated; the entire point of this article is that no matter what (across function boundaries, the reference itself put into the heap, whatever) the member `y` of `X` will be inline with its stack representation.

https://golang.org/doc/faq#stack_or_heap

tatterdemalion··on What Rust Can Do That Other Languages Can't
You've missed a critical point in the article: the structure does not have a pointer to something it has a member inline within its stack representation.

Any garbage collector could (with some overhead) prevent invalid memory access when we're talking about an object with a pointer to another object. Rust is able to validate the correctness of pointers to offsets within the stack representation of an object.

(Rust also validates the correctness of references to heap allocated objects as well, of course!)

tatterdemalion··on What Rust Can Do That Other Languages Can't
This is not a great way to ask a question. Your degrees and years of experience are not relevant to understanding the subject matter of this post. In order to enlighten you, we'd need to know what specifically was confusing about this article to you. What did you not understand?
tatterdemalion··on Lyft surges to the top 10 on App Store following the “DeleteUber” campaign
Its true, in many of the points for which Uber is criticized (including this), Lyft is no better. One might even go as far as to say something along the lines of "there is no ethical consumption under capitailism."

But the point of a boycott isn't to purify one's own ethics, but to get the producer of the boycotted product to change their behavior. To this end it is more productive to focus on the market leader, or the most egregious offender, or some other 'tall poppy' of impropriety, than to try to boycott all actors you believe are unethical.

tatterdemalion··on Doomsday Prep for the Super-Rich
Your point is sound but that's an incredibly bad example. Mexico was already embroiled in the Mexican Revolution by the time WWI started.

> "This armed conflict is often categorized as the most important sociopolitical event in Mexico and one of the greatest upheavals of the 20th century."

https://en.wikipedia.org/wiki/Mexican_Revolution

tatterdemalion··on Rust vs. Go
Copy is essentially operator overloading (it is a simplified, restricted, moves-or-doesn't overloading of the assignment operator), which is always implemented through traits. I agree that operator overloading complects the behavior of built in syntax with the polymorphism system, but the alternative seems worse to me.

However, I don't think binding and use of a variable is 'complected' with its lifecycle. These are semantically significant concepts that I like Rust helping me manage, irrespective of their impact on machine memory.

Also, I should be clear that I do web development professionally and I think the best practices Rust encourages are absolutely applicable to that space, and general application development. That those practices are also high performance in Rust is almost incidental.

tatterdemalion··on Rust vs. Go
Your invocation of Rich Hickey's excellent talk is very confusing to me. It seems like you're using "simple" the way that he used "easy." What is "complected" in Rust's type system? Just because there are "many" concepts, doesn't mean those concepts are entangled. I don't even agree there are that many - Rust lacks inheritance, reflection, and all of their attendant concepts.

In contrast, I find the way Go builds concurrency into the language 'complex' in Hickey's sense. Similarly the way that slices and maps are parametric, but other types are not. The implicitness in interfaces. The way capitalization determines privacy. Go seems like a very 'complex' but 'easy' language.

However, I'd even say I'm not convinced that I want my language to be simple. I want my system to be simple; its possible that by abstracting over an inherently complex domain, and by limiting my choices, a complex language can encourage me to create a simple system. I think ownership encourages the creation of simpler systems. I think a well factored system and a simple system are synonyms.

tatterdemalion··on Rust vs. Go
The main blocker on stable was a feature called "custom derive" or "macros 1.1" which will be stabilized in the 1.15 release in February. At this point any library tied to a specific nightly is using some extremely cutting edge features.
tatterdemalion··on Rust vs. Go
I am a member of the Rust language design team, I am very aware that language design is about trade offs.

I find the ownership model has non-performance advantages in that I find it provides strong design pressure to factor my system well. I would not describe my experience as 'fighting' the borrow checker - I feel positively when the borrow checker sends me back to the drawing board, because it teaches me things about my system I had not properly comprehended.

(There are areas where the borrow checker is overly conservative, but I never hit these in practice.)

> You can't actually tell me whether the above code compiles without consulting other parts of the code. That's not the case for Go. It is thus simpler and more intuitive to program in.

I'm sorry this is just silly. Here's some Go code:

    v2 := v + 1
You can't actually tell me if the above code compiles without consulting other parts of the code, because you don't know if `v` can be added to `1`. In Rust, type inference is only local to a function, so you will be able to determine from an actual compile-able code snippet whether or not that use after move is valid.

Go also actually might not compile on the exact example you cited (translated to Go, of course) because that code contains an error if `v2` is never used after it is assigned.

In general, you cannot reason about the correctness of incomplete code snippets. This is not specific to Rust.

← PreviousPage 3 of 14Next →