Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
shepmaster
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
22 ms
·
91.
▲
by
shepmaster
4y ago
Thank you, but I don’t see any references to “rust” on that page, so I’m not clear on how it serves as a comparison specifically to Rust .
92.
▲
by
shepmaster
4y ago
I am familiar with Rust; is there a good document that compares Val versus Rust? Skimming through this article, I see a lot of similarities between the two but would be interested in knowing more.
93.
▲
by
shepmaster
4y ago
Is likely based on what you compare it to. For example, this passes as well let array = core::array::from_fn(|i| i); assert_eq!(array, [0, 1, 2, 3, 4, 5]); The magic of type inference
94.
▲
by
shepmaster
4y ago
> This is not as good as having an official standard (say, in Cargo.toml) It’s present now: https://doc.rust-lang.org/cargo/reference/manifest.html#the-...
95.
▲
by
shepmaster
4y ago
Wouldn’t you want to use static instead of const, otherwise you might get a new unique mutex at each usage? I think there’s a Clippy lint for that. The playground rebuilds overnight (roughly after the nightly is released); releases don’t
96.
▲
by
shepmaster
4y ago
> println! is a macro, and doesn't "break the tooling" I like, use, and write macros, but this isn't fully true. For example, recent Rust versions allow writing identifiers directly in the format string: println
97.
▲
by
shepmaster
4y ago
> and crates like num_cpus https://doc.rust-lang.org/std/thread/fn.available_parallelis... — Rust 1.59
98.
▲
by
shepmaster
4y ago
And chiming in: > there's no reason why you couldn’t safely promote a u8, u16, or u32 into a usize The people running Rust on a 16-bit architecture (e.g. AVR) would disagree. On those platforms, usize is 16-bit, so promoting u32 to
99.
▲
by
shepmaster
4y ago
I strive to have every commit be meaningful/buildable/testable/etc. To that end, I use a lot of `git rebase -x` to massage the pull request into a reasonable sequence of commits that “tell a story”. Having a bunch of “fixing
100.
▲
by
shepmaster
4y ago
I will type up all the review comments first, then... If I expect or hope the contributor to become a long-term collaborator, I will submit the comments and wait for them to fix it. I'd rather they learn If I don't expect them to
101.
▲
by
shepmaster
4y ago
> map Ctrl(hold) / Esc (momentary press) Do you have an example of this configuration somewhere you could share? Or are you using something existing, like https://github.com/jasonrudolph/ControlEscape.spoon ?
102.
▲
by
shepmaster
4y ago
https://github.com/rust-console/gba
103.
▲
by
shepmaster
4y ago
Ditto with my journey from Warp to Axum. The Rust Playground now uses[1] Axum as its backend and I’ve been pleased with working with the maintainers. [1]: https://github.com/integer32llc/rust-playground/pull/7
104.
▲
by
shepmaster
4y ago
I’ll be even lazier (heh) and just straight up leak memory for true once-set read-only config values. https://github.com/shepmaster/stack-overflow-relay/blob/273a...
105.
▲
by
shepmaster
5y ago
+1 for Axum. I recently moved [1] the Rust Playground's backend to Axum and have been very happy with it and the team producing it. [1]: https://github.com/integer32llc/rust-playground/pull/777
106.
▲
by
shepmaster
5y ago
I lean towards an arena.
107.
▲
by
shepmaster
5y ago
> assumes that String::new will be const at some point It has been const since Rust 1.39 ( https://doc.rust-lang.org/std/string/struct.String.html#meth... )
108.
▲
by
shepmaster
5y ago
I should have worded myself better, apologies. With that example, since you use `Result::map_err` and specify the specific variant, you aren't really using anything from thiserror at the site of the `?`, correct? Most usages I have s
109.
▲
by
shepmaster
5y ago
> snafu vs thiserror/anyhow I'd like to provide a fair comparison [1] in the documentation, but I don't know thiserror / anyhow well enough to feel like I'd give them the credit they are due. That said, to my kn
110.
▲
by
shepmaster
5y ago
> but is a whole crate worth it Yes. I'm not sure exactly what other response you'd expect from the author/maintainer of a library when they've already made a post encouraging other people to use it. ¯\_(ツ)_/¯ &g
111.
▲
by
shepmaster
5y ago
Which language(s) did exceptions the best, in your opinion?
112.
▲
by
shepmaster
5y ago
> how these errors are presented to the user, or what ends up in the logs in production. In those cases something like [...] are significantly more actionable than just the underlying I/O errors by themselves. To the point **where a
113.
▲
by
shepmaster
5y ago
> 15-20 enums (or more) for their error types and it makes things very cumbersome Like everything, it can be a balancing act. I tend to be free about creating error types (one per module, usually, but it's not strange for me to crea
114.
▲
by
shepmaster
5y ago
> you should have the underlying message of the std::io::Error This is a point of debate[1] among the error-handling working group. [1]: https://github.com/rust-lang/project-error-handling/issues/4...
115.
▲
by
shepmaster
5y ago
> Propagation without needing to use boxed trait objects You can also use enums, as shown in the post. You don't need trait objects. EDIT 1 > without needing to use boxed trait objects [...] `anyhow` It's my understanding th
116.
▲
by
shepmaster
5y ago
Check out my sibling comment about SNAFU, which addresses your concerns, if I understand them.
117.
▲
by
shepmaster
5y ago
I'll hype my own library, SNAFU [1]. It simplifies constructing your own "leaf" errors and streamlines the ability of collecting multiple types of errors while attaching more context to them (e.g. filenames, stack traces, use
118.
▲
by
shepmaster
5y ago
A concrete example would be the input (in JSON to pick a format) { "alpha": "3", "beta": "5" } Here, the fields `alpha` and `beta` are serialized as strings but should be treated as numbers.
119.
▲
by
shepmaster
5y ago
> the system would have to be aware of dependencies between pieces of data in order to do it correctly Yep, which is why I expect that a graph is needed to model the validations that I picture in my mind. > so that they can opt in to
120.
▲
by
shepmaster
5y ago
It’s not obvious to me: does this extend to supporting multiple concurrent validations? For example, can you perform a single validation of a structure and get back multiple validation results for each of multiple field? From some thought e
More ›