Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Subjunctive
Sep 12, 2006

✨sparkle and shine✨

People often find it off-putting to be in groups where they feel little commonality. The tweet you quote is describing the poster's feeling, not telling anyone else they need to do something differently.

Adbot
ADBOT LOVES YOU

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Shinku ABOOKEN posted:

Now that I think about it what language design team actually have a woman in it?

Sara Golemon on Hack, for one.

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

the talent deficit posted:

Ingela Andin and Siri Hansen on the erlang team.

Sara Golemon on Hack.

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

The code is eminently reasonable, and the vast majority of pull requests come from cis-het males. There is an imaginary problem being invented here, but it's not by the authors of the code.

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Aren't Rust's macro's hygienic? Maybe I'm missing the point, sorry.

E: new page, whoops

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Just wanted to mention that Firefox beta channel now has Quantum, which includes Servo, which means that in a couple of weeks hundreds of millions of people are going to be running Rust code on their desktops all day, for better performance.

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Oh, I forgot about that!

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Programming Rust is in the latest Humble Bundle, FYI.

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

“What does the profiler say?”

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

The junk collector posted:

Does using a single vector ensure that data is contiguous even after a resize?

Yeah.

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

The junk collector posted:

Awesome, thanks. I guess it's time to do a bunch of indexing.

You might find the Vec allocation chapters of the Rustonomicon interesting as well.

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

QUIC is great and I’m glad a cool dude is bringing it to Rust!

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

JawnV6 posted:

But why do you care about the speed of the glue language?

As any system develops, the amount of logic in the glue code (being that which isn't exactly addressed by the "systems" components) waxes and wanes, but mostly wanes in the larger arc of history. A little policy function or overridden component ends up a few KLOC and a half-dozen imported libraries, and now the interpreter performance matters. You can follow the trajectory of JS performance work for a pretty textbook progression: irrelevant (it's just for gluing browser components together at human interaction speed), then bad-but-tolerable (have to be really careful as you do more work), then competitive-arena (10x leaps, major selling points for competing products, reported on by analysts, unlocking new use cases), and now defend-the-baseline (as you grow the language and ecosystem, make sure that performance holds or improves, but nobody is looking for big wins in execution speed; often other components of performance like latency or memory come to the fore).

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

JawnV6 posted:

I understand the general thrust of this argument, but it is not applicable to the (admittedly minor) ML python work that I've directly experienced. They're pretty good about using FORTRAN when you need FORTRAN.

Your experience is a true statement of your own reality, and I respect it, but my experience is different. ML people gravitated to Lua and then shifted to Python, for Torch. TF is primarily Python. Every ML acceleration startup I had pitch me over 12 months (about two dozen) talked about Python bindings, except for the one that talked about Common Lisp so respect there I guess. One group talked about Forth, but I think they were joking, at least mostly.

Caffe is C++, so you get to explain template compilation messages and dangling pointers and move semantics to mathematicians. In my experience this is painless and productive every time. They never ask questions that make you question the underpinnings of your chosen profession. You will never have ABI weirdness or compiler version mismatch. rjmccall and the rest of the pantheon will look over you and protect you from evil.

E: also, using notebooks in production is the ambition of many data scientists who are doing feature engineering and building models

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Mozilla Legal still makes the calls on DMCA/trademark/etc stuff, at least, and are the contact of record for privacy and data use notices.

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Not gonna lie, I got a bit verklempt when I saw that.

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

I'm brushing off my Rust and am lost in closure lifetime semantics. The explain code for this error isn't making it click and I think I'm just not understanding some underlying principle of the lifetimes here. It's a simple hyper server, and this is the meat of it:

code:
type SecretMap = Arc<Mutex<HashMap<String, String>>>;

async fn handle_request(req: Request<Body>, secret_map: SecretMap) -> Result<Response<Body>> {
    let (parts, body) = req.into_parts();

/* ... */
    
}

#[tokio::main]
async fn main() {
    let addr = SocketAddr::from(([127, 0, 0, 1], 5000));

    let secret_map: SecretMap = Arc::new(Mutex::new(HashMap::new()));

    let make_svc = make_service_fn(move |_conn| async { 
        let secret_map = secret_map.clone(); /* HERE */
        Ok::<_, Infallible>(service_fn(move |req| handle_request(req, secret_map.clone())))
    });

    let server = Server::bind(&addr).serve(make_svc);

    if let Err(e) = server.await {
        eprintln!("server error: {}", e);
    }
}
At the marked line I get this error:
code:
error[E0507]: cannot move out of `secret_map`, a captured variable in an `FnMut` closure
  --> src/main.rs:51:55
   |
49 |       let secret_map: SecretMap = Arc::new(Mutex::new(HashMap::new()));
   |           ---------- captured outer variable
50 |
51 |       let make_svc = make_service_fn(move |_conn| async {
   |  _______________________________________________________^
52 | |         Ok::<_, Infallible>(service_fn(move |req| handle_request(req, secret_map.clone())))
   | |                                        --------------------------------------------------
   | |                                        |
   | |                                        move occurs because `secret_map` has type `Arc<std::sync::Mutex<HashMap<std::string::String, std::string::String>>>`, which does not implement the `Copy` trait
   | |                                        move occurs due to use in generator
53 | |     });
   | |_____^ move out of `secret_map` occurs here

error: aborting due to previous error; 1 warning emitted
I feel like this is me being dumb about Arc semantics, but I thought that .clone(), creating a non-ref value, is what I wanted to do here.

Playground link if anyone's bored enough to explain this to me!

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Yeah, on the advice of a wise person I made a 'static arc<mutex<map>> and cloned that into the innermost call, since that works fine for my small case here. I would like to some day understand how to do this "properly" since it seems like I should be able to move something into the FnMut and have the lifetime work out. Some other day, that is.

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Ah ha! Thank you, I think I understand why that works.

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

“Rust for Rustaceans” has a section on FFI and generally covers unsafe and friends better than most of the other Rust books (excluding the ‘nomicon), FWIW.

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Does anyone know of a Rust training consultancy they’d recommend? I’m thinking of adopting more Rust where I work and as part of that I’d like to look into some structured training options.

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

fart simpson posted:

nope sorry i dont know anything about this

I’d like this to be a sarcastic response from someone who has a bunch of leads on excellent trainers, if we can arrange to inhabit that reality.

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

You’ll be fine. The Rust Book is free and great and designed with non-experts in mind. Enjoy!

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

I know two people whose introduction to programming was the Rust Book, coming from being generally fluent with computers, and they both had a good time. I only have two nickels but still etc etc

One of them did almost get scared off because I accidentally sent them the link for the ‘nomicon instead of the Book, but that was easily remedied.

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Rocko Bonaparte posted:

I suppose if I were running valgrind as I went, I could have caught these with the vague output I got, but I didn't. :(

Can you bisect with git (probably manually)?

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

How would you leak just the NUL terminator? Isn’t that part of the same allocation as the rest of the string?

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Almost always the allocator just gets an address for free, and not a size; the size might not even be known at deallocation time in the case of trait references and such. Most allocators store the size of an allocation in a little bit of memory right before the pointer that gets returned from allocating, if they need to track it at all.

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

If valgrind is telling you the address that leaked, and it’s consistent (disable ASLR? hmm), you could set a conditional breakpoint in the allocator for it returning that address and then see what’s being allocated then.

If it’s not consistent, you can break on valgrind printing out the leaks and manually inspect the memory at that address to see if you can tell from its type info or contents what it is.

Maybe try rr if you’re on a platform that supports it? That would let you go back in time to when the leaked address was allocated, even if the address isn’t consistent.

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

I'm our company's rep to the Rust Foundation, and I've got some miles on me from other open source trademark kerfuffles, so I have some time set aside next week to write up an opinion to send them. I understand their motivation for sure, and I think a robust trademark policy is important for protecting users. We had to use the Firefox trademark to go after places that packaged malware or sold support scams, and it would have been a lot harder to get prompt action without the registrations and policy we had. Avoiding "I installed Rust and it added a cryptominer"/"I bought a Rust T-shirt and it gave me a rash" sorts of things is important for a bunch of reasons.

I'm surprised that use by user groups and meetups isn't just nominative use. It's a user group and it's about Rust and it's in Miami: it's a Miami Rust™ User's Group. Python's policy isn't explicit about user groups, but they seem to be around. (It is explicit about recolourings of the Python logo, though.)

Nick Cameron feels that Rust should be a generic term, like HTML or C++, and that the Rust Foundation/Project should trademark things like "rustc", but I don't think that really provides meaningful protection to the end user, especially since any interoperating compiler will pretty much have to at least offer an option to be invoked as "rustc".

The rust-in-crate-names restriction could have been entirely feasible if at the beginning of crates.io/cargo they'd said "the prefix rust- is reserved for use by the Rust Project or as approved by them blah blah". At this point it would be pretty disruptive to impose I think.

Ultimately, though, I think that the Foundation is going to end up leaving open some avenues of abuse because there's no good legal structure that forbids them without overly constraining good faith uses in ways that an approval mechanism won't be able to scale with. They'll need to use other tools to deal with those abuses, and I can see why it's very appealing to try and solve as many problems as possible with the trademark policy.

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Copilot does a pretty good job with Rust, and the compiler helps you figure out where it went wrong. Code autocomplete or inter-language translation are really in the sweet spot for language models.

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

you mean generate the PInvoke bridging for the exported C interface? your best bet there might be to generate them using a tool that consumes the generated C bindings, though you won’t get nice bundling in objects and so forth

there are not very many actually-good generated binding systems in the world, so moderating your expectations might be key to success here

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

I think Pavex is trying to head that way, with ergonomic metaprogramming and such?

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

prom candy posted:

I am using Typescript, it was the language that initially made me realize that compilers can tell me when I'm being an idiot and it made me completely fall out of love with Ruby.

But, but…Sorbet!

:smith:

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

big black turnout posted:

The general vibe a couple years ago was thiserror for libraries, anyhow for applications

This is the standard practice for our stuff.

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Jon did his book, Rust for Rustaceans. It is probably what you want. Also Aria’s linked-list book and maybe even her blog posts.

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

you could probably write a custom deserializer for that field and do the seeking you want, but I agree that nom is probably a better fit

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

you almost certainly need to have a copy of some of the real macOS libraries; producing Mac binaries on anything but a Mac has always been a nightmare—to the point that one big tech company did a clean-room implementation of those libraries up through UIKit for better automation

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Ranzear posted:

Is there a way to alter the cargo new behavior to add some extra default crates and other toml changes or perhaps change "Hello world!" to "Sup fuckers!" for instance?

Just having the right dev-dependencies already set up for dynamic linking and whatnot would be killer. I don't really want to copy-paste all that into every Bevy project I start up. Seems like years ago it was hardcoded.

https://crates.io/crates/cargo-generate

Adbot
ADBOT LOVES YOU

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Ranzear posted:

This seems like a much cleaner version of the same (absolutely non-)problem. I'll probably just wind up with some kind of script in the root of my projects folder.

the difference here that I thought would be useful is that it allows you to do template variable substitution and prompting, so you could at the least last ask what major version of Bevy you wanted, if not wire up a networked check of some kind

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply