Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
eddyb
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
22 ms
·
121.
▲
by
eddyb
11y ago
You can't compile Rust without types and inside functions, most types come from inference and coercions, so "type checking" is really "type resolution".
122.
▲
by
eddyb
11y ago
The first one would be caught in Rust as it has no integer -> boolean automatic conversions (similar to Java). The second one could only arise with unsafe pointers in Rust, as safe code uses slices, combining the base pointer and the ele
123.
▲
by
eddyb
11y ago
I'm not sure why the author kept &*s, I have suggested &s[..] instead (i.e. "take a slice of the whole string"). And .into() seems to be used as a &str -> String (allocating) conversion for brevity only. The mo
124.
▲
by
eddyb
11y ago
It's actually LLVM, not Clang (which also uses LLVM). Yes, it would be a tremendous amount of work to write a Rust compiler from scratch, but you can also write a LLVM backend. Not in a weekend, but it's possible. Bonus points for
125.
▲
by
eddyb
11y ago
Should that be `long double`?
126.
▲
by
eddyb
11y ago
I have witnessed someone implementing OAuth2 themselves: https://crates.io/crates/inth-oauth2 I hope they solved the problem permanently, since this is the third crate attempting OAuth2 and the first two are abandoned&
127.
▲
by
eddyb
11y ago
A safe GC would be immutable by default, so you end up with a lot of Cells (or worse, RefCells) to emulate a mutable GC like JS or Go.
128.
▲
by
eddyb
11y ago
Proper link: http://www.i24news.tv/en/news/israel/society/84795-150906-yo...
129.
▲
by
eddyb
11y ago
I thought there were solutions, but looking at https://en.wikipedia.org/wiki/Anaphrodisiac all I'm seeing is serious health risks due to side-effects.
130.
▲
Rust-101: A hands-on Rust tutorial
(ralfj.de)
7 points
by
eddyb
11y ago
|
0 comments
131.
▲
by
eddyb
11y ago
Let the future remember the past clearer than we ever could.
132.
▲
by
eddyb
11y ago
Every time I see news of sub-zero superconductivity I get reminded that this site exists http://superconductors.org/ and there's no debunking or confirming of anything on it. You'd think that all these years, so
133.
▲
by
eddyb
11y ago
I'm curious, is there any mention of an "underworld" in any Christian Bible? I had the impression it appeared in other mythologies, whereas the Christian "Hell" is either on "a different plane of existence&qu
134.
▲
by
eddyb
11y ago
I don't follow, why would SSA need to be translated into an input language? LLVM used to have a C backend, yes, but that hasn't been maintained for a while now.
135.
▲
by
eddyb
11y ago
That doesn't solve the fact that blocks and conditional control flow (if/else and match) are expressions and need a way to produce values.
136.
▲
by
eddyb
11y ago
This could actually work fine in Rust, because it has deterministic evaluation ordering for everything (or almost everything, though I can't think of anything that isn't deterministic). Knowing that `++i` is `{ i += 1; i }`, we ha
137.
▲
by
eddyb
11y ago
Neither. Existing successful solutions use tight event loops (the "Reactor pattern": https://stackoverflow.com/questions/3436808/how-does-nginx-h... ). There is a Rust library called "mio" which
138.
▲
by
eddyb
11y ago
I'm not surprised, v8 has a RegExp JIT (irregexp IIRC) which used to be 20x faster than SpiderMonkey's RegExp for simple patterns. Back when I was playing with parsers in JS, the fastest approach to anything string-related was thr
139.
▲
by
eddyb
11y ago
It would be easier to have an implementation for `Arc<T>` which either returns 0, or divides by the refcount.
140.
▲
by
eddyb
11y ago
Ahh, I totally missed the path arguments, my bad.
141.
▲
by
eddyb
11y ago
AFAIK Linux doesn't use zero-terminated strings anywhere in its syscalls, or at least not in those like write, where you pass a size alongside the buffer.
142.
▲
by
eddyb
11y ago
It seems that DJB went a bit too far with his sarcasm. Or it's not entirely clear from the slides alone.
143.
▲
by
eddyb
11y ago
Minor UI issue: the map size doesn't update when resizing the window.
144.
▲
by
eddyb
11y ago
Bitwise operations don't produce Numbers (f64), but signed integers (i32).
145.
▲
by
eddyb
11y ago
"Virtual Structs" is a name for a potential feature that may expose some sort of structural inheritance or subtyping. The name is not used for the current "enum" feature, which is one of the few ADTs in Rust (there'
146.
▲
by
eddyb
11y ago
I did find it a bit surprising that Rust is showing up on the scene that fast. Another interesting project is https://github.com/gfx-rs/gfx-rs - their abstractions may seem too much for wrapping OpenGL, until you rea
147.
▲
by
eddyb
12y ago
I had first seen async/await in traceur-compiler. I was using it with Node.js' fs module two years ago, I believe.
148.
▲
by
eddyb
12y ago
You would have to go out of your way to do so and handing out buffers that allow reading them without initialization would be a huge warning sign IMO. If you want performance, you don't have to worry about zeroing anything, just call `
149.
▲
by
eddyb
12y ago
The latter. It's trivial to reuse buffers in Rust while avoiding this issue, for example `Vec` has a `clear` method that sets the length to 0 while keeping the allocation. But AFAICT, in C it didn't even have the same buffer by d
150.
▲
by
eddyb
12y ago
You would have to use unsafe code and isolate that as much as you can, behind a safe interface. Memory reuse without clearing would be considered safe, though, as none of the other abstractions actually let you read that memory (doing so
More ›