Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
ssokolow
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
20 ms
·
61.
▲
by
ssokolow
4y ago
The argument that generics should have used [] generally goes hand in hand with the argument that [] for panicking indexing is a wart on Rust's "pit of success" design philosophy and that panicking indexing should have been m
62.
▲
by
ssokolow
4y ago
> Any programmer worth their salt knows this. Rust is one big "C and C++ have proven that 'hire better programmers' isn't a viable solution". You might as well use the same logic to argue against C and C++ restri
63.
▲
by
ssokolow
4y ago
That was proposed and rejected for Rust recently: https://github.com/rust-lang/rfcs/pull/3267 I was against because I felt that there should always be parens/brackets/braces (macros can use any of t
64.
▲
by
ssokolow
4y ago
To be honest, I've always been unnerved by "Why is that block ending without a } or END? Is the indentation significant? Is the number of arguments for each construct back-fed into the lexer?" languages like Ante, Ocaml, and
65.
▲
by
ssokolow
4y ago
Which is why Rust has `usize` for indexes and memory offsets. Beyond that, a good programming language can't fix a bad programmer. Were you aware that, because people use `int` so liberally, the LLP64 model 64-bit Windows uses and the
66.
▲
by
ssokolow
4y ago
I think they're saying that it's counter-intuitive that the specialization relationship between Fn, FnMut, and FnOnce is the reverse of foo, &mut foo, and &foo. I know it took me a long time for that to stick.
67.
▲
by
ssokolow
4y ago
> * standard library doesn't have HTTP, requires third-party libraries that are still immature / suck. > * widespread & prevalent abuse of .unwrap() [citation needed] > * rust's async requires third-party librari
68.
▲
by
ssokolow
4y ago
If it really matters, you could always use the #[momo] procedural macro by Andre "llogiq" Bogus, one of the big names in the Rust community: https://lib.rs/crates/momo
69.
▲
by
ssokolow
4y ago
"return" wasn't "abbreviated to an empty string", it's that Rust is expression-oriented, the value of a block is the value of its last expression, adding ; turns expressions into statements, and a function with
70.
▲
by
ssokolow
4y ago
It's directly responsible for Rust needing the "turbofish" syntax to pin down generic return types as in let foo.iter().map(|x| x*2).collect::<Vec<_>>() If they'd used something like [T] for generics, then th
71.
▲
by
ssokolow
4y ago
It means "DANGER: This may hide an early return or other things which violate the expectations for how control flow works."
72.
▲
by
ssokolow
4y ago
Because Rust is, in effect, a GC-less Ocaml derivative with a coat of cherry-picked C++ syntax as paint. That's why the semantics are so different. It's more of the lineage that began with ML in 1973 than of the ALGOL 68 lineage l
73.
▲
by
ssokolow
4y ago
I'm migrating everything that's feasible (eg. not stuff where I need Django's ecosystem) from Python to Rust for its combination of a powerful type system that can encode my invariants better than MyPy annotations, sum types,
74.
▲
by
ssokolow
4y ago
It sounded like they were saying "both pools have a lot of qualified applicants, but C++ has incentives to draw an additional flood of un/under-qualified applicants that haven't started to apply to Rust yet".
75.
▲
by
ssokolow
4y ago
I'm reminded of this quote, written in support of more and stronger use of systems for formal verification, like powerful type systems: > Program testing can be a very effective way to show the presence of bugs, but it is hopelessly
76.
▲
by
ssokolow
4y ago
More importantly, it means that version upgrades are decoupled. They don't have to download and install version 1 of an API for backwards compatibility if you're on version 2, and you don't have to download a new compiler ver
77.
▲
by
ssokolow
4y ago
Aren't soldiers typically issued submachine guns? (That's what SMG is short for, isn't it?) I think they might have been going for the ludicrous image of sticking a bayonette onto the front of a fixed gun emplacement.
78.
▲
by
ssokolow
4y ago
Must be another one of those supply chain disruptions.
79.
▲
by
ssokolow
4y ago
> but malloc/free based systems also have a relatively high memory overhead due to fragmentation In case you haven't seen it, there's been some interesting progress on that front: https://www.youtube.com/wa
80.
▲
by
ssokolow
4y ago
Google is investigating Rust as part of a multi-pronged strategy and, while it has the "this is not an official Google project" boilerplate, the `autocxx` crate (a header-parser/code-generator addon for the `cxx` interop crat
81.
▲
by
ssokolow
4y ago
Rust seems to excel in having an ecosystem that provides binding helper libraries like PyO3, Neon and napi-rs, Helix, etc. which both ensure "if it compiles, you're doing the C glue properly" and provide a layer for automatic
82.
▲
by
ssokolow
4y ago
Matter of taste. I find Rust perfect for hobby projects because: 1. Squashing bugs that show up after the code successfully compiles (or, in Python's case, appears to work) is a big drain on motivation. 2. The ecosystem's focus on
83.
▲
by
ssokolow
4y ago
I think the big thing that hurt Pascal initially was the poor start it got off to. By the time things like Borland Pascal came around and fixed the weaknesses from explicitly starting as a teaching language, the damage had already let C pul
84.
▲
by
ssokolow
4y ago
As well as syntactic constructs. For example, Rust's unusual 'a syntax for lifetime parameters is Ocaml's syntax for generics because lifetimes are a special class of generics.
85.
▲
by
ssokolow
4y ago
Funny. It seems to matter enough to me that I'm making plans to rewrite projects I can't host out of GitHub pages in Rust to optimize how much VPS I have to pay for.
86.
▲
by
ssokolow
4y ago
And yet real-world Rust projects consistently have significantly lower memory footprints than real-world Java projects (with people often commenting on the memory savings they observed from porting away from Java, even just to Node.js) as w
87.
▲
by
ssokolow
4y ago
Ahh, so more or less what I'm doing. Design the Rust code as if it's going to be a generic C library with bindings for multiple languages and then write a PyO3 binding layer that just clones however much is necessary to convert un
88.
▲
by
ssokolow
4y ago
Not really. For me, the number-one Rust feature I love is that, by baking monadic optionality and error return in from the beginning (Option<T> and Result<T, E>), I can trust that, unless an author abuses panic! (in which case I
89.
▲
by
ssokolow
4y ago
> If you fail to heed the fact that Rust is not really an OOP language, your entire program will start to look like the hairy parts of C libraries that interface with the Python interpreter. Any tips for those of us who see PyO3 as one o
90.
▲
by
ssokolow
4y ago
The bits of Rust that feel "bolted on" were known to Rust's developers prior to the v1.0 freeze. You can go back through the mailing lists and find talk about things like higher-kinded types and guaranteed tail call optimizat
More ›