Live data from Hacker News

A Rust FFI adventure in unsafety

travisf.net

21–30 of 54 posts

Re: A Rust FFI adventure in unsafety

#21
post #6

Earlier quoted context omitted.

What do you use as your development environment?

vim + w0rp/ale, ale has LSP support and I now use it as a one stop shop for go to dec, find refs, and autocomplete. It has support for linting with cargo, rustc, rls, and autoformatting with rustfmt. rustup makes installing rls extremely painless.

mind sticking up the relevant sections of your vimrc somewhere so I could take a look?

the rust stuff in my vim dates to v. early post 1.0 and would love to link ale + rls up.

Re: A Rust FFI adventure in unsafety

#22
post #8

Earlier quoted context omitted.

> Cargo + RLS are the best ecosystem tools I've seen in any language. In my experience the java profilers and debuggers are still better than anything that's available for rust. RLS is great on a fundamental level (decoupling IDE from compiler), but it still has to catch up in functionality with the total compiler integration that for example eclipse has with ecj.

We don't use Java. Java is old, of course it has plenty of tooling, but it also has a mountain of negatives in it's own right, besides the fact that it's not suitable for systems level work.

You switched from C++ to Rust and don't use Java because Java is old.

You've made at least one person's mood a little lighter today. Thank you.

Re: A Rust FFI adventure in unsafety

#23

Earlier quoted context omitted.

We don't use Java. Java is old, of course it has plenty of tooling, but it also has a mountain of negatives in it's own right, besides the fact that it's not suitable for systems level work.

You switched from C++ to Rust and don't use Java because Java is old. You've made at least one person's mood a little lighter today. Thank you.

You misread. Java being old is counted as a positive here; Java is old, so it has plenty of tooling, is the message. Despite this, they are not using Java :)

Re: A Rust FFI adventure in unsafety

#24

Earlier quoted context omitted.

We don't use Java. Java is old, of course it has plenty of tooling, but it also has a mountain of negatives in it's own right, besides the fact that it's not suitable for systems level work.

You switched from C++ to Rust and don't use Java because Java is old. You've made at least one person's mood a little lighter today. Thank you.

[deleted]

Re: A Rust FFI adventure in unsafety

#25

> We wanted a primitive that would guarantee that initialization of the global variables would happen exactly once. IIRC, At one time, there was a "lazy_static!" that fit this use case? But maybe you can't do that here if what you need is the side-effect of the library call.

Also, there is `once_cell` that seems to be a more general form

https://crates.io/crates/once_cell

Re: A Rust FFI adventure in unsafety

#26
post #9

Earlier quoted context omitted.

When you switched was it a unanimous decision to write rust? And is this a small team where you all have the same opinion? Or did you have to drag any one along? From what I have seen people who aren't motivated to learn rust struggle. I'm curious how that worked out

There was some convincing, we had to sell why we felt Rust was worth rewriting some of our tools in, and that it was ready for primetime. An initial small group of us spiked and wrote integrations for our logging, tracing, and wrote a Rust compiler for our rpc IDL. After that, we kind of got some shocked reactions as to how we were able to move so quickly and that things actually seemed to 'just work'. We also kept e…

Did you lose any developers during this period?

Re: A Rust FFI adventure in unsafety

#27

Earlier quoted context omitted.

There was some convincing, we had to sell why we felt Rust was worth rewriting some of our tools in, and that it was ready for primetime. An initial small group of us spiked and wrote integrations for our logging, tracing, and wrote a Rust compiler for our rpc IDL. After that, we kind of got some shocked reactions as to how we were able to move so quickly and that things actually seemed to 'just work'. We also kept e…

Did you lose any developers during this period?

No, in fact it's been a selling point in our hiring. Rust seems to jive with a wider audience, it has aspects of FP, C++, and the tooling solves a lot of pain points for more seasoned developers and has energized some of our employees who felt burnt out on pushing our older services forward.

Re: A Rust FFI adventure in unsafety

#28

Excellent and detailed post! Up until now I've been focusing on Julia and Swift for projects that can use a new language, as the Rust pain/productivity ratio has looked too high. Perhaps things are changing...correctness is certainly a worthy goal!

I've been using Rust in production for a little over half a year, and my team and I have run into very few issues. We're also calling through the FFI to an SGX SDK and a large C++ codebase, and that's been delightfully painless. We're all extremely glad we chucked C++ and Go and switched to Rust. Rust isn't just a safer C++, it's a language that stands on it's own as extremely productive, safe, and fun to write. We c…

Would you have any sort of stats on your productivity with C++ vs. Go vs. Rust?

Re: A Rust FFI adventure in unsafety

#29
post #21

Earlier quoted context omitted.

vim + w0rp/ale, ale has LSP support and I now use it as a one stop shop for go to dec, find refs, and autocomplete. It has support for linting with cargo, rustc, rls, and autoformatting with rustfmt. rustup makes installing rls extremely painless.

mind sticking up the relevant sections of your vimrc somewhere so I could take a look? the rust stuff in my vim dates to v. early post 1.0 and would love to link ale + rls up.

Sure, install w0rp/ale using your favorite plugin manager, install rustup and run:

  rustup component add rls-preview rust-analysis rust-src --toolchain nightly
then add this to .vim/ftplugin/rust.vim:

  let b:ale_linters = {'rust': ['rls','cargo','rustc']}
  let g:ale_fixers = {'rust': ['rustfmt']}
  let g:ale_completion_enabled = 1

Re: A Rust FFI adventure in unsafety

#30

See, this is why you need the lines above and below the letter I. I thought this was a Rust remake of Final Fantasy 1. So disappointing...

> the lines above and below the letter

Serifs is the word you are looking for.

Hmm, from examining the font style in the stylesheet, and playing around it looks like Verdana is preferred, and then it falls back to Geneva, and then some default sans-serif.[1] Verdana has serifs though, and Geneva either doesn't or I don't have Geneva, so that seems an odd choice of preferences and fall backs.

1: The CSS is "font-family:Verdana, Geneva, sans-serif;"

Post reply on HN