
I've just learned Rust and I think I'm in love - JoshTriplett
https://rskupnik.github.io/I-learned-rust-and-I-think-Im-in-love
======
hprotagonist
_Not only that, any code examples in rustdoc are treated like tests and get
executed during compilation! That ensures that your examples are not obsolete
(or at least that they compile)._

That is a genuinely great idea.

~~~
_ZeD_
It's present in python too

~~~
hprotagonist
but as usual, it's optional.

~~~
agumonkey
such is life, especially in dynlangs, things got added, it's already cool that
it's known and works finely as it is.

maybe one day domains, limits and code/proofs will be a single entity in
source

------
taco_emoji
> You just go to [https://rustup.rs/](https://rustup.rs/) and that’s pretty
> much all.

Not if you're behind my corporate proxy, unfortunately. I set the HTTPS_PROXY
environment variable properly (which is annoying -- other apps are able to
deal with the proxy transparently) so that I stop getting 407 errors, and then
I get:

    
    
        info: caused by: [35] SSL connect error (schannel: next InitializeSecurityContext failed: Unknown error
        (0x80092012) - The revocation function was unable to check revocation for the certificate.)
    

I've tried various fixes from the (still open) github issues: set some config
setting to prevent the cert revocation check (only works for cargo, not
rustup) and installing the cert from static.github.com (doesn't fix the issue
at all).

EDIT: I was actually able to workaround this, finally, based on this github
desktop issue[0]. It involves registry hackery and disabling cert validation
in SCHANNEL which is not ideal (and I will be reverting it once rust is
installed). I certainly don't have the mentioned Russian crypto library
installed on my machine, so I have no idea what could be ultimately causing
cert revocation check to fail on my machine...

[0]
[https://github.com/desktop/desktop/issues/3156](https://github.com/desktop/desktop/issues/3156)

~~~
Arnavion
Does your proxy block OCSP requests to LE's servers? LE's OCSP server goes
down from time to time and causes that same error for everyone, but if it's
happening consistently for you it's more likely to be because of your proxy.

------
amelius
Wait until you've read this:

[https://news.ycombinator.com/item?id=16442743](https://news.ycombinator.com/item?id=16442743)

~~~
tspiteri
If you want to write a linked list like you do in C, just use pointers instead
of references, mark your code as unsafe, and basically you have it.

I'm not suggesting this is a good idea, but I'm tired of the linked list
argument which kind of implies Rust is much harder than C for an equivalent
linked list implementation. If you explicitly choose to lose the extra
guarantees, Rust is about as easy as C to write a linked list in.

~~~
sp332
I think I understand this. It's difficult to write concurrency-safe linked
list operations in C too. This is a case where I would lean on the standard
library for sure. Is there a different kind of problem you'd recommend to just
dip your toes in?

~~~
oconnor663
Implementing a singly-linked list in Rust is much easier, because you can use
`Option<Box<...>>`. (That is, each node in the list can hold the unique
pointer to its tail, so it's easier for the compiler to prove to itself that
everything you're doing is fine.)

Working through the Entirely Too Many Linked Lists book in general is super
helpful, since it deliberately runs into the cases that are hard.

Implementing a hash table in Rust would probably be fine as a toe dip too.
It's that multiple-references-to-each-object part that really burns you in the
doubly-linked list case.

------
xyproto
I understand the advantages of Rust over C or C++, but what are the advantages
over OCaml, Standard ML, D and Go?

~~~
kllrnohj
Rust's combination of no GC, unsafe escape hatch, and zero-cost C ABI FFI
(both function calls and struct layouts) are among its biggest technically
differentiating factors.

The FFI story seems to be overshadowed, but if you want to use things like
Vulkan, DX12, etc... then C FFI performance becomes absolutely critical, and
many languages are really bad at it.

~~~
vvanders
I think the importance of selecting a C FFI is very much undersold.

You pretty much get interop with every major language for free. I've embedded
Rust in Python, Java, C# and WASM/ASMJS pretty much with just that one feature
alone.

Also makes the migration story really strong, which I think was largely driven
by needing to be integrated into FireFox in a sane way.

~~~
nickpsecurity
I've gone further to say the freight train of an ecosystem behind and legacy
effects of C mean any intended replacement should be fully compatible with its
structure, calling conventions, etc. This lets anyone leverage existing C
libraries or those in new language seemlessly. From there, the new stuff might
all be done in better language with optional, incremental rewrites of older
stuff.

[https://lobste.rs/s/5pnqdv/why_is_sqlite_coded_c#c_vhdcyt](https://lobste.rs/s/5pnqdv/why_is_sqlite_coded_c#c_vhdcyt)

------
rcdmd
As someone who's only dabbled in Rust (writing a few <500 line projects in a
mostly non-idiomatic style), I've enjoyed every minute. "Fighting the borrow
checker" gives an extra challenge and keeps things fun when not stressed for
time. I'm still not using it seriously "in production," but it's easy to
identify with the love of the language other beginners have.

------
dugluak
Is there an example with source code of a complete system developed using
Rust?

~~~
rmorey
> Is there an example with source code of a complete system developed using
> Rust?

www.redox-os.org

------
alokitr
Just wait... It will turn sour as all other infatuations. Or maybe it will
crystallize into actual love. Who knows?

