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
sarehu
Apr 20, 2007

(call/cc call/cc)

PlesantDilemma posted:

When Rust was first getting attention I remember a lot of discussion about it having built in support for concurrency like the Go language. Recently when I hear about the language everyone talks only about the memory safety aspect of the language. Does Rust still have built in support for concurrency, or am I not remembering things correctly?

They dropped that cooperative green threads system so that it's only merely a library, instead of being something inseparable from the language (or more substantially, inseparable from the rest of the standard library).

There's still aspects of the language that pay homage to concurrency, though, like how you can only have one mutable borrow at a time (if I'm not mistaken).

sarehu fucked around with this message at 02:36 on Jan 31, 2015

Adbot
ADBOT LOVES YOU

sarehu
Apr 20, 2007

(call/cc call/cc)
Oh. For some reason I was only thinking mutable borrows on multiple threads would be a bad idea because I did not consider how coarse-grained borrowing would affect other things. If only they had typestate so that you could express borrowing more precisely...

sarehu
Apr 20, 2007

(call/cc call/cc)
Looking at some linked list code, such as http://doc.rust-lang.org/0.12.0/src...t.rs.html#37-41 or some other linked list I saw, I notice that they wrap the unsafe pointers in a Rawlink<T> type. What is the purpose of doing this? Right now I assume it's so they only have to say "unsafe" in one place, or some bogus pretense at safety by making the value accessible only via an Option type as if null pointer dereferences were the danger and not use-after-free. Am I wrong?

sarehu
Apr 20, 2007

(call/cc call/cc)
A reason to do that is to avoid making virtual function calls. If the behavior of the solver was not entirely defined by the type, you could pass in the solver as a function parameter of type T (or reference to T or something) and still get that advantage.

Reasons not to do that: compile time, executable size, performance costs of code bloat.

Edit: If virtual function call performance is not a concern, I'd go with the version that uses virtual function calls. Either way, at the call site you're going to be parameterizing the behavior of the function, either as a template parameter or a runtime parameter. It is perfectly reasonable for a thing parameterizing the behavior of a function to be an "object".

sarehu fucked around with this message at 02:00 on May 5, 2015

sarehu
Apr 20, 2007

(call/cc call/cc)
Whether a macro is complicated or the function is complicated, it's still just as complicated. It's really fruity that they don't have a non-macro version, though, but probably that would operate on bytestrings and not unicode strings, or static-lifetime string slices or whatever the gently caress a string literal is.

sarehu
Apr 20, 2007

(call/cc call/cc)
Apparently write() returns a Result<usize, Error>, and unwrap() will panic if the result wasn't a success.

Also I get warning: unused result which must be used, #[warn(unused_must_use)] on by default if you omit it -- it doesn't mind that the usize returned by .unwrap() is ignored.

sarehu
Apr 20, 2007

(call/cc call/cc)
I think the official docs are awful, and some of the surrounding media is bad too, and some random blog articles are good. It doesn't help that the language has been unstable, so a lot of older docs keep getting updated like Wikipedia.

"Consume" is something you'll see C and C++ people use to refer to invalidating an object or pointer (in particular, taking ownership of it), the usage here is nothing new. (It's probably terminology used in other languages, like the way Lisp's (NREVERSE X) would be said to "consume" X, but I can at least testify to C/C++ usage.)

sarehu
Apr 20, 2007

(call/cc call/cc)

Jabor posted:

Seems less useful than if Result<> just behaved like a proper monad IMO.

It does.

sarehu
Apr 20, 2007

(call/cc call/cc)
Have them draw lots, the loser gets hormone therapy.

sarehu
Apr 20, 2007

(call/cc call/cc)
They didn't kick him out, they acted passive-aggressively towards him until he stopped contributing. After he left, a certain contributor would close issues that he'd opened with bothering to understand them, giving reasons that didn't actually engage with the issue.

With Rust, it's like, instead of just disagreeing with you, a core team member will pop in and insinuate that you're lying.

Edit: Basically me : Rust :: michaelochurch : VC's

sarehu fucked around with this message at 02:27 on May 19, 2015

sarehu
Apr 20, 2007

(call/cc call/cc)
You don't have to tone police the docs, thank you.

sarehu
Apr 20, 2007

(call/cc call/cc)

Lunixnerd posted:

Rust seems really cool and interesting but this: https://www.rust-lang.org/conduct.html is loving cancer. I hate it that this tumblr level safe-space bullshit is invading CS topics. It encourages outrage and taking offense while simultaneously discouraging being an adult and hardening the gently caress up. It also serves to minimize the contributions of people that don't have a place in the reverse hierarchy of 'privilege' that tumblr likes to go on about, sorry I'm not a disabled, mayonnaise gendered, polysexual, fartkin gypsy black woman quadriplegic, I hope my pull request gets some attention nonetheless because I'm trying to add value despite being a cis-het white male AKA literally hitler.

Sorry you're not a rape victim/breast cancer haver.

quote:

We are committed to providing a friendly, safe and welcoming environment for all, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, nationality, or other similar characteristic.

Translation: Hail Hydra.

sarehu
Apr 20, 2007

(call/cc call/cc)

quote:

We interpret the term "harassment" as including the definition in the Citizen Code of Conduct;

Never mind building, you can't even read their code of conduct without downloading an external dependency.

sarehu
Apr 20, 2007

(call/cc call/cc)

piratepilates posted:

You've got some real problems if you read that and parse it as anything other than "be nice to people, don't be a dick"

Seriously? Online forums have had "rules" that are about "be nice to people, don't be a dick," since forever, for example, and they read a lot differently when they aren't full of dog-whistles and designed to reinforce a certain political thesis about how the world is.

sarehu
Apr 20, 2007

(call/cc call/cc)
Yeah it's funny how much effort they go through for that when C++ gets it just by overloading.

sarehu
Apr 20, 2007

(call/cc call/cc)
Or the end user could understand what's going on. You should be able to "see the allocations" -- they're as visible as they are in C++.

sarehu
Apr 20, 2007

(call/cc call/cc)
I went to a Rust meetup a couple days ago. Seven people showed.

One guy was a C guy asking questions who seemed to have shown up with no idea what Rust was for. He asked what is it for. He also asked if it had as good a prepocessor system as the C preprocessor. Another seemed to know quite a bit about Rust, and other things. Another guy spent the entire time editing some Medium post. We spent the time doing an exercism.io exercise where an object has a mutable String field.

But, as a result, I wrote my actual first self-originated line of Rust code, so there's that!

Edit: On that note, is there any way to make a match pattern redundantly declare the type of a variable? Take for example
code:
pub fn hello(name: Option<&str>) -> String {
    "Hello, ".to_string() + &match name {
        Some(s) => s.to_string(),
        None => "World".to_string()
    } + &"!".to_string()
}
I wanted to write Some(s: &str). That doesn't work. Is there any way to do that?

sarehu fucked around with this message at 08:09 on Aug 19, 2016

sarehu
Apr 20, 2007

(call/cc call/cc)
San Diego.

sarehu
Apr 20, 2007

(call/cc call/cc)
:catstare:

Well I'm going back, which is something I can't say about Haskell or ACCU meetups I went to. Maybe I'll sperg about the mutex API next time.

sarehu
Apr 20, 2007

(call/cc call/cc)
What's the best GUI api for Rust right now? And by "best" I mean "least likely to be broken." On Linux or Windows.

Edit: Like all I want to do is paint on a window.

Edit: Got gtk-rs examples working so I'll run with that.

sarehu fucked around with this message at 00:06 on Aug 26, 2016

sarehu
Apr 20, 2007

(call/cc call/cc)
I went to another Rust meetup. The pizza got delivered early so it was cold, had to be reheated. Some dude showed up with a 1600x1200 T60p, then another dude pulled out some old 4:3 X-series tablet. I had a VPCZ1 Vaio Z, and some other guy had a Dell. A big improvement from the everybody-but-me-uses-Apple situation. crazysim forgot his laptop (self-owned!).

sarehu
Apr 20, 2007

(call/cc call/cc)
The former is not immune, I think the implementation is just too dumb for it. Another example is that Option<Option<bool>> could use 1 byte.

Adbot
ADBOT LOVES YOU

sarehu
Apr 20, 2007

(call/cc call/cc)
Yeah, it would have solved a problem I had before, where something expected a T: FnMut(..), but I had no way to return anything but a Box<FnMut(..)> to pass up to that. (But come to think of it, maybe I could have passed a wrapper of the boxed function?) But now you won't get successively deep wrappers of stuff like that.

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