Live data from Hacker News

Why I’m dropping Rust

medium.com

11–20 of 164 posts

Re: Why I’m dropping Rust

#11
It seems the author is trying to do classical OOP using traits (type classes). They aren't a match although the similarities.

I understand his rant, but I don't think it is a valid one. You must change your design or change your tool, he opted to change the tool.

Re: Why I’m dropping Rust

#12
post #5

The author seems to be confusing typeclass composition with OOP. They are only topically similar. (Personal opinion; typeclass composition is more principled than OOP, but a bit more rigid, which he is running into.) There are several good ways to do this with type classes/traits. One way is to write a function font_size : Widget t => t -> FontSize And then in the widget definition have the "internal" font size defin…

Exactly, you can't expect to "port" code across from languages in different paradigms without rethinking the design a little bit.

I really like traits/type classes over OOP-style type systems but sometimes it causes a bit of impedance mismatch.

Re: Why I’m dropping Rust

#13
post #5

The author seems to be confusing typeclass composition with OOP. They are only topically similar. (Personal opinion; typeclass composition is more principled than OOP, but a bit more rigid, which he is running into.) There are several good ways to do this with type classes/traits. One way is to write a function font_size : Widget t => t -> FontSize And then in the widget definition have the "internal" font size defin…

[deleted]

Re: Why I’m dropping Rust

#15
post #7
post #4

Rust seems to be a poor match for the way the author wishes to solve this particular problem. That doesn't mean that their design is wrong, or that Rust is wrong, but it does mean that mixing the two would require rethinking parts of the design. > So a trait can define abstract functions, but can't access any underlying fields. In Rust, a trait is a purely abstract interface to a type. It explains how you can use tha…

> The usual solution is to put the cyclic graph code into a library, and to use pointers and about 20 lines of unsafe code. It's not much different from the C++ solution. Well, petgraph uses vectors and indices to avoid unsafe code, and it's the most popular graph library on crates.io. Really, the answer here is "use a graph crate on crates.io". If you don't know which one to use, the best answer is probably petgraph…

A lot of problems in Rust seem to involve replacing (smart) pointers with handles. Sometimes you really do want to do that, but it's bad if it's a necessary kludge.

Like someone else said recently, it's a problem if you can't reasonably teach a basic computer science course in Rust.

Re: Why I’m dropping Rust

#16
post #14

I think it would be fair if you also would disclose that you are working in Mozilla and that you are directly connected to Rust when defending it on HN.

While disclaimers are common (for some reason), it has no effect on the virtue of his points.

It's just fluff.

Re: Why I’m dropping Rust

#17
post #14

I think it would be fair if you also would disclose that you are working in Mozilla and that you are directly connected to Rust when defending it on HN.

I think pcwalton's extensive knowledge on not just how to program in Rust, but the rationale behind various design decisions should indicate to a careful reader that he is involved in Rust.

Re: Why I’m dropping Rust

#19
post #9
post #7

Earlier quoted context omitted.

> The usual solution is to put the cyclic graph code into a library, and to use pointers and about 20 lines of unsafe code. It's not much different from the C++ solution. Well, petgraph uses vectors and indices to avoid unsafe code, and it's the most popular graph library on crates.io. Really, the answer here is "use a graph crate on crates.io". If you don't know which one to use, the best answer is probably petgraph…

> Well, petgraph uses vectors and indices to avoid unsafe code, and it's the most popular graph library on crates.io. Nice! I hadn't seen that yet, but it looks really interesting: http://bluss.github.io/petgraph/doc/petgraph/graph/struct.Gr...

Not sure if it's just me, but the ampersands at that link are displaying super weirdly on my end:

https://i.imgur.com/Bg8rejM.png

Re: Why I’m dropping Rust

#20
post #14

I think it would be fair if you also would disclose that you are working in Mozilla and that you are directly connected to Rust when defending it on HN.

Why? It would be fair if he was trying to push a product, but here it's just a technical discussion.
Post reply on HN