Is rustfmt fast enough to reasonable be put on a save hook?
I went into one of my projects and did a `cargo fmt`, took 2.2 seconds. Dunno if that's within your tolerances or not. I personally have CI check it, rather than on save.
Rust 1.24
31–40 of 215 posts
Re: Rust 1.24
#32Is rustfmt fast enough to reasonable be put on a save hook?
Re: Rust 1.24
#33Earlier quoted context omitted.
They really very different but... + Static typing (extra safety, robust refactoring, code completion etc.) + Much much faster and less memory use + Compiles to a relatively standalone binary (not as good as Go though) + No Python 2/3 nonsense to deal with - Much more complicated. You have to deal with lifetimes and borrowing and so on. It's really very difficult and we still don't know how to write some types of prog…
> Compiles to a relatively standalone binary (not as good as Go though) Whats the difference?
Re: Rust 1.24
#34Can someone sell me on using rust over python? I am just gernerally curious as to the advantage beyond rust being compiled.
Especially how Rust enums and structs make it easy to define new types to guide your programs are a highlight for me.
I don't think Rust is better than Python for every task. Python is a lot simpler if you can get something done with its built in types (dicts, sets and lists). Python's dynamic types are also a great benefit for some tasks, where Rust's dynamic dispatch support is very limiting.
Crazily, handling dependencies and building a project is way easier in pure-Rust than pure-Python since it's standardized.
Re: Rust 1.24
#35Is rustfmt fast enough to reasonable be put on a save hook?
I went into one of my projects and did a `cargo fmt`, took 2.2 seconds. Dunno if that's within your tolerances or not. I personally have CI check it, rather than on save.
Re: Rust 1.24
#36Earlier quoted context omitted.
Performance is quite a bit higher for rust. And it's a much safer language by design (and forces the programmer to be as such). That said, development time in Python is much faster. Honestly, it depends on what you're building.
I'm curious what parts of Rust you think are safer than Python. Edit: The only big thing I can think of is the safety of compile-time type checking to ensure you won't end up with some kind of runtime error from mismatched types. Is there something I'm missing?
Re: Rust 1.24
#37> If you’re a fan of str::find, which is used to find a given char inside of a &str, you’ll be happy to see this pull request: it’s now 10x faster! This is thanks to memchr. Wait, how is that safe? Aren't Rust strings UTF-8? Even if you search for a ASCII character, couldn't it conflict with the second byte of a different unicode codepoint?
Re: Rust 1.24
#38Earlier quoted context omitted.
Performance is quite a bit higher for rust. And it's a much safer language by design (and forces the programmer to be as such). That said, development time in Python is much faster. Honestly, it depends on what you're building.
I'm curious what parts of Rust you think are safer than Python. Edit: The only big thing I can think of is the safety of compile-time type checking to ensure you won't end up with some kind of runtime error from mismatched types. Is there something I'm missing?
Re: Rust 1.24
#39Earlier quoted context omitted.
Performance is quite a bit higher for rust. And it's a much safer language by design (and forces the programmer to be as such). That said, development time in Python is much faster. Honestly, it depends on what you're building.
I'm curious what parts of Rust you think are safer than Python. Edit: The only big thing I can think of is the safety of compile-time type checking to ensure you won't end up with some kind of runtime error from mismatched types. Is there something I'm missing?
(I'd recommend using a language with garbage collection unless you really need to not though; OCaml is quite Rust-like but means you won't have to worry about the borrow checker)
Re: Rust 1.24
#40Can someone sell me on using rust over python? I am just gernerally curious as to the advantage beyond rust being compiled.
When I use Python I miss Rust's enums, the pattern matching of those enums, and the static types that help refactoring (the compiler spots where one change has knock-on effects in the rest of the project..). Especially how Rust enums and structs make it easy to define new types to guide your programs are a highlight for me. I don't think Rust is better than Python for every task. Python is a lot simpler if you can ge…
In recent versions Python got some nice improvements in this area, with the new way of creating NamedTuples, Data Classes and the typing module. I wrote a stackoverflow answer recently that sums it up, if anyone is interested: