Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
wycats
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
20 ms
·
151.
▲
by
wycats
12y ago
Also, the location of storage is slightly more visible (in general) in Rust than in other languages. I have personally found this to be pretty clarifying, because as much a we may like to abstract over it, the location of storage often worm
152.
▲
by
wycats
12y ago
Yes. It's a design bug that String and slice don't share a common trait and that `.as_slice()` is common simply to use slice methods. I expect that to be fixed before 1.0.
153.
▲
by
wycats
12y ago
For what it's worth, String in Rust is similar to StringBuffer in other languages. You can append to a String; you can't append to a slice, which always represents a fixed view. A slice has storage that is borrowed from somewhere
154.
▲
by
wycats
12y ago
I think it's, in general, useful to differentiate the speed of code-writing as a new developer and the speed of code-writing as an experienced developer. The reality is that people have very little time to try out new languages, and ha
155.
▲
by
wycats
12y ago
Just tried this on my Moto X: Me: "Find me a target" <nearest target shows up> Me: "Directions" <changes to "directions to target"> <shows a list of targets to select> Me: "first one"
156.
▲
by
wycats
12y ago
The default is 1:1 threads. If you use `spawn` in Rust, you get a native thread.
157.
▲
by
wycats
12y ago
I don't know what this means. I stand by my upstream comment.
158.
▲
by
wycats
12y ago
> You can write safe code that crashes in rust. That absolutely violates the safety guarantee whatever the reason for it. You can write Ruby code that calls into unsafe C code and SEGVs. This is a bug in the C code you called. It should
159.
▲
by
wycats
12y ago
> In rust there are two types of code. 'safe' and 'unsafe'. The above is only true if your entire code path contains only safe code. I think this is actually a misconception. In every high-level language (Ruby, Python
160.
▲
by
wycats
12y ago
I specifically address this pattern towards the end of my post (it's essentially the same pattern as Ruby's approach).
161.
▲
by
wycats
12y ago
In Rust, you often use stack allocation, which, as you pointed out, is much more efficient. There's some heap allocation in Rust, but in my experience it's actually a minority of all allocations. Rust also has an Arena library ( h
162.
▲
by
wycats
12y ago
There is an important distinction in Rust: ownership. Copyable objects are (by definition) simple enough that copying them does not introduce aliasing. Objects with heap pointers or destructors cannot be copied, because now there would be t
163.
▲
by
wycats
12y ago
I'm a little bit confused. Every object that gets allocated has to be freed at some point. That cost is the same no matter how the memory is managed. Are you talking about an additional cost beyond "freeing memory that was allocat
164.
▲
by
wycats
12y ago
Also, there are a whole host of very common types (integers, etc.) that actually want to be passed by value and copied. There's no point in making a pointer to an integer and then dereferencing the pointer in the callee when an integer
165.
▲
by
wycats
12y ago
For those who might have been wondering, "UB" means "undefined behavior".
166.
▲
by
wycats
12y ago
What happens if there's a cycle? It will get closed when the cycle is finally collected. You can rely on a GC (and refcounting + a cycle collector is absolutely a GC) to finalize your resources for you, but it is quite difficult to rea
167.
▲
by
wycats
12y ago
To be more specific, automatic dropping will likely always be scope-based. In the rare case where you need to drop something before its owning scope completes, you can explicitly use `drop` as people have said downstream. Borrows are a diff
168.
▲
by
wycats
12y ago
This is silly. {Event_Nonexist, "Does not exist", "Exists", "Existence changed", "Existence not changed"}, ProcessDoesNotExist EventType = "Proces
169.
▲
by
wycats
12y ago
Yes, if you want type-checked generic monads. Dynamic languages can implement generic, but not type-checked monads. Many static languages can implement type-checked but non-generic monads. Now you need to show how type-checked generic monad
170.
▲
by
wycats
12y ago
Yes, compiler plugins. For a relevant example, check out the Rust docopt crate[1]. An identical technique could be used for yacc or protobufs. [1]: https://github.com/docopt/docopt.rs
171.
▲
by
wycats
12y ago
A few: * https://github.com/carllerche/hamcrest-rust - a (badly in need of more fleshing out) testing library * https://github.com/carllerche/nix-rust - bindings of Linux/OSX-specific APIs to
172.
▲
by
wycats
12y ago
I'm sure that seemed true about web browsers too. The trick is feature flagging all new API surface and only including flagged code when it's deemed stable.
173.
▲
by
wycats
12y ago
I think things have changed :) Steve Klabnik has been doing a ton of work on the docs, and that has brought a lot of "coming from an HLL" perspective to them.
174.
▲
by
wycats
12y ago
One of the cool things about the Rust ownership system is the lease/borrow system. Moving is cool, but much of the time you want to synchronously call another piece of code and give it a temporary (stack-frame-long) lease for that poin
175.
▲
by
wycats
12y ago
Interesting!
176.
▲
by
wycats
12y ago
> The second production deployment of Rust is a Ruby gem, written in C, that calls out to Rust. It's used in skylight.io, if you're curious. Yep! I'm one of the authors of that project. The fact that Rust provides automati
177.
▲
by
wycats
12y ago
I think what you want is a cycle collector, and to invoke it at appropriate points. I don't see why Rust couldn't have a refcounted pointer type with an invokable cycle collector, but maybe someone on the core team could chime in
178.
▲
by
wycats
12y ago
Yes! The fact that Rust has zero-runtime-overhead automatic memory management is a big deal. I've been using Rust for almost a year, and it's been a source of great delight for me.
179.
▲
by
wycats
12y ago
> The problem with language package management systems is they've been used for installing user facing software. As a developer tool I think it is the perfect way to go. Precisely so.
180.
▲
The Tilde Art Project You Have to See to Believe
(blog.skylight.io)
4 points
by
wycats
12y ago
|
1 comments
More ›