Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
dbaupp
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
32 ms
·
301.
▲
by
dbaupp
8y ago
Clang isn't using LLVM's inline asm directly, it translates from the (stable) GCC format into the internal LLVM one. rustc could theoretically do the same translation, but implementing that is significantly more work than just sta
302.
▲
by
dbaupp
8y ago
> But for -fno-delete-null-pointer-checks, you're relying on the second optimization, moving the dereference later. Otherwise you'd just have segfaulted already (or, in a kernel context, the read might have succeeded from a us
303.
▲
by
dbaupp
8y ago
Yep! That's why it's equivalent to Add::add(a, b), not a.add(b). (This was definitely something I had to check, though, and, as you say, a tiny detail that's almost certainly irrelevant to most code that people write.)
304.
▲
by
dbaupp
8y ago
> But which one of those? The situation is far simpler than that sentence implies; a + b is (always) equivalent to Add::add(a, b). The same trait/impl rules apply to + as to normal trait function calls. > Are there implicit t
305.
▲
by
dbaupp
8y ago
There was no need to "well actually" that, as it is the same point the parent was making: that money (and UB abuse) is why the tuned compilers now exist.
306.
▲
by
dbaupp
8y ago
No, it's something that Pony relatively explicitly doesn't allow: AIUI, iso (non-aliasable, read/write), val (aliasable, read-only, no write) and tag (aliasable, no read or write) are the only things that can be shared betwee
307.
▲
by
dbaupp
8y ago
I can think of a few possible problems with IEEE754-across-the-wire, such as: - not all hardware supports them - subnormal numbers are annoying - NaNs can be tricky to handle, such as signalling and (if payloads are used) security risks thr
308.
▲
by
dbaupp
8y ago
> Zig's errors are actually different and the variants can be statically known. Error type returns are not usually specified since they can usually be inferred. They can be explicitly specified if needed [1]. Yep, as a sibling po
309.
▲
by
dbaupp
8y ago
Ah that explains it: I was looking at the now-old https://andrewkelley.me/post/intro-to-zig.html#error-type
310.
▲
by
dbaupp
8y ago
I think you haven't understood my point or maybe I haven't understood yours, and maybe it is because I have misunderstood Zig's approach. My understanding is that something like `fn f() -> %T` returns a T or an `error`, an
311.
▲
by
dbaupp
8y ago
That sounds quite similar to Rust, except less fine-grained than Rust. The Result type has an Error parameter which is usually an enumeration of the possible failure conditions, e.g. https://doc.rust-lang.org/std/io&#
312.
▲
by
dbaupp
8y ago
Somewhat surprisingly, you can relatively quickly move from the world of raw pointers and direct hardware interaction to safe abstractions (or at least single-point-of-unsafety, typically on construction, requiring that a pointer points to
313.
▲
by
dbaupp
8y ago
That's not how lifetimes work, and their strength is not in stopping memory leaks: both because they do not do that, and because memory leaks aren't the biggest problem. Rust's lifetimes record when values are valid and when
314.
▲
by
dbaupp
8y ago
One technical reason is Rust has safe dynamic (de)allocation (and without a GC), whereas I believe Ada misses that large segment of the "market" (it theoretically allows a GC, but IIRC the implementations do not support that meani
315.
▲
by
dbaupp
8y ago
Are you referring to https://dlang.org/spec/module.html#scoped_imports ? If so, I believe imports in Python and Rust work similarly, and, say, JS's 'require' seems to too.
316.
▲
by
dbaupp
8y ago
Java also doesn't run collection unless there's interaction with the GC. This is why people put a lot of effort into avoiding allocation in inner loops via primitives and object pools, because doing so ensures that the GC won'
317.
▲
by
dbaupp
8y ago
Turing completeness of the type system isn't what causes C++'s unsafety: in a sense, being turing complete theoretically allows encoding more safety into the type system. It also allows encoding more impossible-to-write-a-progra
318.
▲
by
dbaupp
8y ago
I think one of the core differences that informs a lot of the other trade-offs is Rust has minimal runtime (e.g. no garbage collector, works in bare metal environments), whereas Pony (I think) is willing to have a heavier-weight runtime wit
319.
▲
by
dbaupp
8y ago
JS is IEEE754, not a (one's or two's) complement-based representation.
320.
▲
by
dbaupp
8y ago
The "unwrap" is referring to getting a plain T out of a Foo<T> container: all of those "unwrap" functions return a plain T. One way to look at them is "unwrap", "or" and "or_else" are
321.
▲
by
dbaupp
8y ago
> "you can build whatever want on top of it" is a flashy way to say that "rust can't do that" in this instance. It most definitely is not. "It" in "on top of it" refers to the language itsel
322.
▲
by
dbaupp
8y ago
I think you mean Result or Either like Haskell etc., not Maybe. Additionally, Swift has essentially the same approach to C FFI.
323.
▲
by
dbaupp
8y ago
That's defending against hash collisions which isn't what the grandparent is noticing (the slowing down of memory accesses due to not fitting into cache).
324.
▲
by
dbaupp
8y ago
I don't think the author, Erica, uses "he".
325.
▲
by
dbaupp
8y ago
Many package managers interpret semver in a similarly mechanical way, e.g. npm, bundler, cargo (and, I think, elm-package, and I'm sure others too), but they choose different versions based on that information.
326.
▲
by
dbaupp
8y ago
> Go packages can have side effects. For example a global map, background goroutines, shared connection pools, etc. Including multiple versions of the same package would not work for these cases. Yes, that's a problem too, but th
327.
▲
by
dbaupp
8y ago
> they claim that C++ exception handling produces "undefined" behavior (it doesn't), Exception safety (i.e. ensuring state is transactional) is hard in any language, but it's extra-hard in C++ where doing it incor
328.
▲
by
dbaupp
8y ago
I think my comment explicitly addressed why that general (and fair: I really hate credit-stealing) concern doesn't apply here.
329.
▲
by
dbaupp
8y ago
... While your history comments can be interesting, not every comment about a feature of Rust needs a "rebuttal" about how it wasn't the first language with that feature. Especially not a comment that wasn't even mildly
330.
▲
by
dbaupp
8y ago
Every time you say this, someone rebuts you, or asks you to explain, but you seem to completely ignore any feedback. Could you be more specific? Rust has nowhere near the incidental complexity of C++: there's so many features/synt
More ›