Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
dbaupp
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
83 ms
·
811.
▲
by
dbaupp
10y ago
I think this is the point that is obscured when discussing "manual memory management" vs "GC" languages and just focusing on the behaviour/life-cycle of an individual allocation: the former generally provide tools a
812.
▲
by
dbaupp
10y ago
Rust has libcore, which is, in many ways, more featureful than libc despite also having zero dependencies. From my perspective, the main advantage of C is the way in which chip manufacturers only provide (poorly supported/bug-ridden) C
813.
▲
by
dbaupp
10y ago
You're 100% correct that the end goal is safe software in a way that's practical to achieve. However, having the computer check one's code is generally regarded as a great way (even the best way) to do this: NASA's JPL d
814.
▲
by
dbaupp
10y ago
I assume you're talking about why reqwest is necessary (i.e. why hyper is moving to async), rather than the single paragraph mentioning asynchronicity as a possible future direction for reqwest? Async I/O is important for more tha
815.
▲
Parallel iterators, part 3: Consumers
(smallcultfollowing.com)
1 points
by
dbaupp
10y ago
|
0 comments
816.
▲
by
dbaupp
10y ago
The whole "you're tolerant so you have to tolerate intolerance!!1!" thing is not some clever loophole, it's just a weak attempt to justify why people shouldn't be called out for being unpleasant/bigoted. http:
817.
▲
by
dbaupp
10y ago
It is a macro that just helps you define a type that implements the appropriate traits so of course it works with the rest of the world. No-one outside the crate that uses it even needs to notice, as one could just write out the definition
818.
▲
by
dbaupp
10y ago
That approach has its own problems, such as wasting memory (need to store any data for each tag value separately, rather than benefiting from overlapping storage ala Rust enums or C tagged unions), as well as losing type safety: one has to
819.
▲
by
dbaupp
10y ago
Have you seen that rustup makes using musl with rustc really easy [0]? One can then additionally forgo things like the optimised jemalloc allocator and the main standard library (just using libcore) to knock the binary size down to what C
820.
▲
by
dbaupp
10y ago
The wrapper function controlling the lifetime is exactly why that scheme has both of the problems I mentioned. It all comes down to: how do you write a fn connection() -> DB? You can't (or, at least, it doesn't make sense to) r
821.
▲
by
dbaupp
10y ago
That has both of the problems I mentioned even if it isn't a full language level construct.
822.
▲
by
dbaupp
10y ago
A programming language can't anticipate every possible thing someone might want to do (or else every program would be one line: doMyThing()), the best it can do is provide tools for building the final product. Rust is pushing hard on m
823.
▲
by
dbaupp
10y ago
It does provide a pile of helpful constructs (references, slices, generics, privacy), which, if they don't work 100%, are still brilliant building blocks for creating abstractions that expose safe interfaces, allowing the areas where &
824.
▲
by
dbaupp
10y ago
I don't think this is a useful point, because by the same logic: - Haskell doesn't eliminate memory safety issues, they happen when using unsafePerformIO (or Foreign.*Ptr, or inside the runtime, your choice), - Python doesn't
825.
▲
by
dbaupp
10y ago
As I said, a slice can point to any memory, it doesn't matter where it came from: i.e. your allocator/things using it can expose slices instead of just plain pointers. Generics and privacy are definitely language features, and the
826.
▲
by
dbaupp
10y ago
What's a specific memory safety issue Rust has outside `unsafe` code?
827.
▲
by
dbaupp
10y ago
> What i’d want is a generic support for preventing buffer overflows, or bad memory access where i need it You have that. For example, if you have contiguous memory, the various forms of the [T] slice type can be used, they don't
828.
▲
by
dbaupp
10y ago
RAII (i.e. destructors that automatically run on values when leaving a scope) is what lets one avoid manually freeing Box and Vec, so you want to split the world into "destructor resources" (RAII) and "with resources", m
829.
▲
by
dbaupp
10y ago
One can get all of the problems mentioned with allocators other than malloc, up to and including using only the stack. Also, sure the implementation of another allocator might use a smattering of `unsafe`, but I'm guess that it will be
830.
▲
by
dbaupp
10y ago
This isn't wrong, but it seems to be putting the cart before the horse: even with limitations, having generics is still an improvement over not having them, in terms of one's ability to build type-safe abstractions (i.e. Rust woul
831.
▲
by
dbaupp
10y ago
> - The type system is unusual, and complex. It's hard to do anything without templates. Do you mean the generic types and functions that stop you having to reimplement a whole pile of common patterns and data types yourself? You&
832.
▲
by
dbaupp
10y ago
Some platforms only have (bug-ridden, poorly supported) C compilers available: i.e. there's no other language to write in, let alone bind to.
833.
▲
by
dbaupp
10y ago
There's http://intermezzos.github.io/
834.
▲
by
dbaupp
10y ago
FWIW, Copy already behaves like that in Rust: a "custom" Copy impl is just opting in to the default copy implementation, there's no way for the programmer to inject any code. The reason the impl is required is to ensure peopl
835.
▲
by
dbaupp
10y ago
If you're going to consider unsafe blocks in other libraries (and especially the standard library) as just as "bad" as ones in your own, you have to include the compiler itself too ("oh your compiler generates machine co
836.
▲
by
dbaupp
10y ago
The programming model exposed to the user is synchronous, which happens to be implemented on top of the asynchronous primitives the OS provides.
837.
▲
by
dbaupp
10y ago
The Rust team puts a lot of effort into not gratuitously maligning anything, including a "competitor" language like C++: discussions of other languages try to be as factual as possible, and, Rust is very happy to adopt the good
838.
▲
How I Code and Use a Computer at 1,000 WPM by Sina Bahram [video]
(youtube.com)
2 points
by
dbaupp
10y ago
|
0 comments
839.
▲
by
dbaupp
10y ago
That problem is true of practically any language, even C and C++, and the solution is the same (and well accepted) for all of them: write a small set of controlled primitives in raw assembly, and let the "high level" language comp
840.
▲
by
dbaupp
10y ago
You're still talking about "race conditions" and "concurrency errors", whereas I am talking specifically about data races not arbitrary race conditions or concurrency errors . I don't see how the first illustr
More ›