« first day (2198 days earlier)      last day (1290 days later) » 

8:07 AM
So what crates do the cool kids use for drawing stuff (line, rectangles, other shapes) to an image buffer?
 
 
5 hours later…
12:55 PM
I have this new golden hammer but I don't want to abuse it
2
 
Hey congrats!
 
Thanks!
 
Looks like a reasonable target to me.
 
@trentcl One thing I (attempt to) do is to evaluate the dupe target answers to see if they can be improved to be more inclusive / accommodating.
Like, can they be widened to answer the new question more directly, without ruining their existing audience.
 
1:31 PM
it's growing into a whole new answer. heck with it, I'll just cross-link them
 
@trentcl that's kind of what I thought might happen.
 
TIL about the "kinda common" "One-iteration loop" Rust idiom. This will let me remove a few stupid closures from my code
 
@DenysSéguret I'm interested, what is that? :-) Is that std::iter::once(T)?
 
std::iter::once(T) === Some(T).into_iter()
 
@Shepmaster I see, I didn't know that, haven't used it yet.
 
1:48 PM
@Jason iter::once is way more obvious of meaning though :-)
My guess, as we wait breathlessly for @DenysSéguret, is
for x in an_option {
    // use x
}
 
(I'm the Canop answering)
 
@Shepmaster Huh, that's interesting! I've never seen that before. The loop seems to work on a single Option? When would one prefer this over if let Some(T)?
 
@Jason prefer? probably never.
 
To be clearer: the goal is to have early "return" in local computations. Another solution is to use a dedicated function so that you can use a return.
 
But see
12
A: Conditionally iterate over one of several possible iterators

Niko MatsakisPersonally, rather than use Either, I often prefer to create a series of Option<Iterator> values that get chained together. Something like this: playground use std::iter; fn main() { let x: Option<i64> = None; // Repeat x 5 times if present, otherwise count from 1 to 5 for i in pi...

oh, using valued break statements
@DenysSéguret you saw the sibling, right? reddit.com/r/rust/comments/jekjeo/…
 
2:05 PM
Oh...
When do we break the feature gates ?
So many things are only in nightly... just to tempt us...
 
@DenysSéguret Ah, I get it. Cool! :-) I haven't read that blog post yet, saw it elsewhere as well.
 
2:25 PM
posted on October 20, 2020 by Camelid

The Rust project gets many issues filed every day, and we need to keep track of them all to make sure we don't miss anything. To do that we use GitHub's issue labels feature, and we need your help to make sure we fix regressions as soon as possible! We have many issue labels that help us organize our issues, and we have a few in particular that mark an issue as a regression. These labels will

 
> i tried asking this in the rust discord beginner section, but i only got rude answers so im hoping there is at least some nice people in the rust community that can shed some light over this.
Man, they are likely to be disappointed.
 
Is the rust discord that bad? I haven't participated there. I'd sat around in the IRC, and it wwas always pretty friendly
 
discord doesn't seem a proper medium to handle issues when there are more than 5 users, especially if people aren't well disciplined and used to the place
 
discord/IRC has its own kind of etiquette that some people can find offputting, much like SO
 
2:29 PM
(I also haven't participated in the Rust discord)
 
Huh. IRC was always super casual.
 
I've been there. I've seen questions come and go away with the flow
 
I mean, the contributors channel was not. But I don't contribute to the compiler, so I didn't try to participate there
 
the poster seemed easily discouraged.
 
(It wasn't rude, just less casual)
 
2:30 PM
i did not understand anything of your answer because im a beginner, what "if activated" or "short circuit". And my question was closed withing 5 minutes, witch just tells me yet again that the rust community is non friendly. Im going to avoid asking questions and will probably not continue with rust. — Thomas Andolf 1 min ago
called it
 
> Im going to avoid asking questions and will probably not continue with rust
Is that a 4 yo ?
 
Heh. Yeah. IDK, if you can't look up terminology you don't know... I can't help you.
 
you have no social skills, as it seems. Contrary to him.
 
Heh. I mean, I think I explain things fairly well, and I also do in fact have friends. So, he can think what he wants XD
I understand wanting an explanation, but it's incredible to me how people want you to hold their hand through finding out how words are defined. Like, go find where it's written down. I think wikipedia has a valid definition for short-circuiting in programming.
 
@Zarenor I haven't been there in a while, but I've had very positive experiences.
 
2:37 PM
@Jason That's good to hear. When I was lurking in IRC, Steve was always super helpful. Not sure if he's able to participate as much in his new role, but there was definitely a helpful culture.
 
@Jason to be fair, you found this chat, which means that you tried pretty hard to do things the "right" way
 
@Zarenor Steve is great! I was about to look at a talk he's going to give on his open-source work.
@Shepmaster He, I try to. I don't know what's up with the other user, maybe they're quite young and easily upset.
 
user14466490
Hi Community!
 
user14466490
2:52 PM
I am new over there
 
Welcome there, so
 
@ShayanKanwal Hi there! :-)
 
3:11 PM
Today I was reminded that try_clone is important when working with TCP streams.
 
user14466490
thanks a lot how do join your group is there any specific process to join any group
 
@ShayanKanwal Welcome! Regarding this chatroom, just feel free to stick around. :) We don't have a "group" per se other than the ones already in the Rust community.
 
user14466490
ok tha
 
5:14 PM
@trentcl yes, let the power flow through you
 
Soon I shall be unstoppable!
 
5:31 PM
@trentcl You'll know you've hit the big time when there are /r/rust threads about you <3
 
5:43 PM
Hello! I am new here, a Rust fan, but still don't have any project on it.
 
@MaxiMalvido Hi! :-)
 
Hi! :D
 
6:01 PM
A downside of clippy's injonction to use the matches macro is that returning false is kind of less visible
but maybe it's just because I'm not yet used to spot those !matches!
 
Agreed. We should be able to write ¡matches!
 
mismatches! or clashes! ?
 
One thing I like about Ruby is that you usually have the inverse function name
select and reject instead of Rust's dumb filter
 
Not saying I wouldn't like that but a downside would be the already hard to scan lists of functions in core types and traits would be even longer
 
6:17 PM
certainly.
 
@DenysSéguret I've used that one before but after writing it out I also thought someone else might have difficulty in making sense of it.
 
Which one ? I wouldn't have changed the negative ones but clippy would have beaten me had I not
 
@DenysSéguret !matches!()
 
btw I hope those macros don't slow down (more) the compilation
Is somebody looking for some RIIR opportunity ? xdg-open looks like a mess in wait for a replacement...
 
6:38 PM
@trentcl woo you scared me
 
@Shepmaster scared?
 
@trentcl "why are there 7 updates"
 
oh lol
there's 19 mistagged questions by the looks of things
I'll be done soon
huh, one of them is actually correctly tagged
 
6:53 PM
@DenysSéguret since the OP changed their question, you want to post your is_ok answer?
 
@Shepmaster no, I'm not answering anymore, I don't remember how this part of SO works
 
@DenysSéguret And it got accepted over the better answer. Shrug.
 
7:12 PM
I'm not sure I've even had to loop with a is_ok. When don't you use none of the values ?
sigh
Ended going with while !stream.write(& buffer).is_ok() {};. Short and concise way. — TheSylex 4 mins ago
 
@DenysSéguret Hope no one unmounts the drive!
 
and people think rust prevent bugs...
 
Bitcoin might not take over the world, but it does seem to take over Stackoverflow
2
 
7:55 PM
Where does this "Rust doesn't have static variables" meme come from?
I don't get it
 
static RUST_HAS_STATIC_VARIABLES: bool = false;
@trentcl This works more than you think — you can ask the person who said it.
 
It's a common gloss. Rust of course has consts and static variables. but they have to be Sync, which quite a constraint
(that is, statics have to be)
And they can't be mutable, you've got to do the same multithreaded dance you have to do for anything in rust. But which is uncommon everywhere else - statics in C# crop up with fair frequency, and are also often mutable, and just wildly unsafe
They are an antipattern there, but that doesn't stop... far too many people
 
Academic-level Java code like ALL THE S I N G L E T O N S
 
:((((
but yeah, exactly that sort of thing.
 
8:10 PM
I know the feel.
(narrator voice: it would stay this way forever)
 
Heh. I'm 'lucky' in that the academic code I help with on weekends is.. not singletony. But that's largely because I built it. And it's just a few thousand lines, maybe.
I should say I and my classmate back in uni
and it's in MATLAB (as a re-write from SM). I keep wanting to RIIR, but I haven't quite gotten enough done to do that. I'd have to handle a bunch of the plotting bits and add a bunch of configurability that's just hacking in the source right now.
 
@Zarenor they can be mutable just fine ;-)
 
hahahah
static mut LONG_INT_DONT_CARE : u64 =0; and just unsafe {LONG_INT_DONT_CARE +=1;} as needed! It's beautiful.
 
use std::sync::atomic::AtomicU64;
static LONG_INT_DONT_CARE: AtomicU64 = AtomicU64::new(0);
 
8:26 PM
That would be the right answer. But we're not talking about the right answer.
😉
 
thread_local! {
    static LONG_INT_REALLY_DONT_CARE: Cell<u64> = Cell::new(0);
}
@Zarenor I get that people struggle with the details, but saying "Rust doesn't have statics" is just silly
 
I understand the sentiment. There's a lot of fear and bogeyman-like lore around threading. It's ~~scary~~. So the 'easy' explanation to not get in the weeds is that Rust doesn't have statics. or that it doesn't have statics in the same way as other languages.
I'm not sure I agree with that framing, but I'm liable to just get in the weeds until someone's eyes glaze over
I'm only explaining the reasons I've seen other people use that gloss.
 
Understood.
 
The other side is that because other languages just throw them around, it can't be so bad, right? So I'll just sprinkle in the unsafes all over to 'fix' the problem and do what I've always done. I think there's a fear it will desensitize people to unsafe - they might take it as not actually that dangerous. Of course, that's just a misunderstanding of how unsafe it always was (in) in those other languages.
 
I felt that frustration upgrading from I think VHDL-1993 to VHDL-2008
which was when the language started requiring shared variables to be "protected types" (VHDL's version of synchronizing access to an object)
If memory serves, I eventually fixed it by eliminating all the shared variables. So yeah.
 
8:43 PM
:upside_down_smiley:
 
Ick. Yeah, in C# I'm trying to write more readonly code so it's more object-lifetime bounded. And when threading is involved, there are a couple of methods I use.
C# does have async, but there's some messiness in the red/blue coloring vs threading vs old-style callback-based async.
 

« first day (2198 days earlier)      last day (1290 days later) »