« first day (2170 days earlier)      last day (1305 days later) » 

1:16 AM
@EnnMichael My guess is iter.by_ref().take(n)
 
 
8 hours later…
9:32 AM
I see now. But why new_foo1 even exists, if it is so faint? — Aleksey Kanaev 5 mins ago
I mean, because you wrote it?
 
9:49 AM
@PeterVaro Yes, this sounds like it. Thank you!
 
10:06 AM
@E_net4theaccountreporter LOL, I would've commented that there :see_no_evil:
 
 
1 hour later…
11:27 AM
It is still a mystery to me why this is safe/OK.
 
 
2 hours later…
1:07 PM
@E_net4theaccountreporter why's that?
 
1:37 PM
@Shepmaster If it copies the data, why is the input behind a mutable reference (Clamped<&mut [u8]>)? If it does not copy the data, how can it own the data behind that mutable reference?
 
1:49 PM
I think it copies the data (it has to move the array to the GC'd JS world) and I bet it implements some weird trait that requires it to have an exclusive reference OR this is the way the implementer wanted to make sure only a single reference exist to this array? vOv
(Nice catch, nonetheless)
 
If it is copied, it should not require exclusive access to the slice. And I don't imagine this function modifying the slice before the copy.
And this brings another question: how would one do this without the extra copy?
I don't think one is able to fetch a mutable reference to the ImageData's internal buffer.
 
@E_net4theaccountreporter You can't, that's a current limitation, what I was referring to as:
> The only thing I loathed was the fact that I still needed some HTML and JS overhead to make things work :/
Until we will have direct access to GPU from WASM (and paint anything on the browser window) we have to go through this..
@E_net4theaccountreporter very unlikely
 
Still, I am talking about the abstraction provided by wasm bindgen. If this one doesn't have this kind of access, it won't ever have it.
Even once we have direct access to Web APIs via WebAssembly.
 
Oh, right, I think you are correct there
 
2:05 PM
@Shepmaster You're a part of the reason why I even decided to learn Rust. Your work is extremely important, thank you
2
 
Now that is star material.
 
@EnnMichael thanks!
 
I find it amazing in general how many awesome people work on this language and the ecosystem around it for free. Rust really does have a great community around it
And I might be wrong about this next thing but, I think that the borrow checker and ownership and lifetime schematics are the first new practical feature in language design in a while. It's like a real breath of fresh air instead of rehashing the same old thing over and over again
 
Aye, my impression is that only a few languages were taking their type system to powerful levels (Haskell kind of level), but seeing a type system capable of proving memory safety without GC is quite a power move.
 
@EnnMichael uhh. I don't do it for free. Did you not receive my invoice?
/me rattles cup with coins in it
 
2:18 PM
(don't worry, you can request a reissue for payment in cookies)
 
@Shepmaster Do you get any income from donations and stuff? You are a Rust consultant/trainer if I remember correctly?
 
@EnnMichael yep, consultant. No donations as such, but via jobs / trainings.
I've thought about adding one of the ways for people to pay for various OSS work, but never gotten around to it.
 
@Shepmaster Any good prospects on that end? I have a vague idea that people are still reluctant to pay for OSS contributions.
 
@E_net4theaccountreporter I'm not reluctant, per se, but I am lazy
I'd probably try to use githubs payments thing
because that seems like the least friction.
 
2:34 PM
@E_net4theaccountreporter There are some OSS devs who earn a lot (like 100k$ per year) through github/patreon donations
 
*licks lips*
2
 
@Shepmaster From what I saw, it looks like the best one ATM
 
It does give me slight pause about the GLOBAL GITHUB HEGEMONY
 
Heh. Microsoft is still massive and wanting to win capitalism. So... yeah, it's a problem.
 
This isn't the main problem. IMO it's a detail
 
2:42 PM
@DenysSéguret ...rrreeeeeaaaalllly? I haven't heard of such beasts..
 
@DenysSéguret What's the real problem?
 
A few problems, or risks, of asking for donations:
- making a spectacle of yourself. From what I saw, the devs who earn a lot are the ones who entertain a big audience on youtube and twitter. I'm not sure you can be a winner at that game without being very exhibitionnist
- having to publicize your work (and not just the result)
- the work attribution is a problem: will you keep everything ? try to invent an unfair way of distribute the revenue ? and what about the other OSS things you incorporate ?
And of course it's not morally or practically compatible with a salaried activity
Note that I don't advocate against setting up a GH account for donations. I mention the problems.
 
I don't understand this:
> the work attribution is a problem: will you keep everything ? try to invent an unfair way of distribute the revenue ? and what about the other OSS things you incorporate ?
> changing what's today a voluntary gift to society into a work
IMO the gift has always been the end result not your labour:
 
> and what about the other OSS things you incorporate
 
Work attribution: I mean there are people who regularly contribute to your OSS. And people give you money because of what they help you build.
 
2:54 PM
Ohhhh
got you
 
@Shepmaster This part has a solution, at least — contribute a portion back upstream.
Which is part of tidelift.com, IIRC
 
@Shepmaster (unbelievable how limited the chat is, when it comes to "threading".. well, when it comes to anything really..)
 
@DenysSéguret I do think that a lot of what you say are things that people should ask / be answered before giving/receiving money.
 
@PeterVaro that's why I invented wzins (visible reply chains) into Miaou
 
@DenysSéguret Could we push SO to replace this garbage with Miaou?
 
2:58 PM
@PeterVaro The best IMO would be to OS the SO chat... so that we can fix it. But the SO team didn't agree back when there was a community willing to invest into improving it
 
surprise, surprise
@Shepmaster Not the giving ones, but surely some of these questions are very important from the receiver's perspective, no? But I agree that @DenysSéguret maybe argued more about the full-time (F)OSS contributors rather than the casual ones
 
@PeterVaro well, someone hoping to make money via this should know upfront that "entertain a big audience on youtube and twitter" is a way to increase the amount (if true). People wanting to give money should know that the person they are giving money to does / does not do that.
But yeah, you should ask yourself the questions, answer them, then stick them next to the donation request.
 
If I were in the position of Shep, I'd probably try the GH sponsorship thing
 
I'm very glad that Shep is worried about the GH hegemony
 
"What does donating get me?" — (a) "warm feelings and nothing else" (b) "if you donate > 100$/mo I'll review your issue next", etc.
@DenysSéguret why my position specifically?
 
3:04 PM
@Shepmaster You're independent, right ?
 
@DenysSéguret ah, yeah.
 
and you're an obvious positive contributor to the whole rust ecosystem
 
I can see one problem with Shep gaining too much public attention though: Kirby.
 
Yeah, poor Nintendo, Shep should definitely donate back to that company..
 
@E_net4theaccountreporter I've always wondered about that. Without actually knowing, I think I'd get by on fair use.
 
3:08 PM
"I don't claim to be Kirby" :)
 
However, if Nintendo comes after me because I'm making that much money, then ideally I can pay an artist to make something Kirby-evocative.
 
it wouldn't make it better, especially as this comment proves it tries to be kirby evocative
 
@Shepmaster A Ferris-Kirby hybrid.. shivering
 
Legally you should just not use kirby in your sites and official docs
 
Shepmaster: Fearless OSS master of dream land
 
3:10 PM
I think one thing that donations would help with would just to know how useful a given project is.
 
It would only indicate how the users of a specific project are willing to pay
 
That's the main pain point of OSS. It's very very rare to know how much (or whether) what you did was useful
 
another project could be more useful
but its users are.. let's say poorer.. or maybe just unwilling to pay..
 
@PeterVaro certainly. It's a weak signal, but a signal nonetheless
And unlike stars, there's an incentive to re-allocate it
 
@DenysSéguret That's why I believe in FOSS and not OSS. It is useful regardless of its usefulness if that makes sense. If my software is not in control over me, then I am in on control over it. That is useful on its own right.
("that's why" <-- this is not true, but one of the reasons)
 
> With respect of software, every part (including the implementation) that's not developed according to an accepted standard is considered SOUP
Does an ISO standard have any meaning beyond "this is the shape that something must have"?
Like, it seems like I could make an ISO standard that says "this programming language is guaranteed to produce UB for every addition of two 8-bit numbers".
which is a standard, but it's not useful
 
It's the only way to gain the prestigious title of standard pedantic.
I mean, it would probably make sense if we had a bunch of compilers claiming to be Rust compatible.
 
3:39 PM
Oh, I think that it's a given that it will have to happen
multiple implementations, a standard, then maybe even an "official" standard
 
So the question is whether we need it to be an ISO standard?
 
The standard mentioned in the question isn't a standard of a language but a certification of languages or part of them for usage in a processus done according to a standard
 
My question is just a pedantry thing. Like, C++ has an ISO standard (assuming that's what the link is), but C++ has codified UB.
 
The real question seems to be about certifying Rust for some usages and description of the relevant constraints, and I don't see that for anytime soon...
 
@DenysSéguret that's what the comments are about, at least.
I dunno if the question is about anything so detailed (or obvious)
 
3:43 PM
I believe it's possible to write a ISO standard C compiler in just a couple lines of code
(the loophole being that compilers are permitted to not compile any code and fail with a diagnostic)
 
@trentcl ROFL (It was a long time when I read the standard as a bible so I can't assert the truthiness of this, but it sure sounds plausable.)
 
panic!("This compiler has determined that there is most likely a bug in your code.")
 
I hope the standardisation is very far away. Having the "historical" baggage and rolling legacy implementations just so that we can say we have a standard is not my definition of having fun.
 
@PeterVaro I'm not 100% sure it's true, but it does make a funny illustration of the limitations of formal standards.
 
@PeterVaro The interesting part is the research into the best practices for more secure programs written in Rust, like in ssi.gouv.fr/en/guide/…
 
3:51 PM
@DenysSéguret That looks exciting! Have you read it?
 
> I'd really love to use Rust for writing the medical software I develop.
No one tell @E_net4theaccountreporter
 
@Shepmaster I thought the same when I read that :D
 
And I don't see how Rust is stopping you from doing that.
 
@PeterVaro just part of it, it's open-source: github.com/ANSSI-FR/rust-guide
 
They wouldn't be the first (see e.g. Imeka).
 
3:53 PM
The good point: they don't write a lot of verbose bullshit, they keep it simple and aim to be useful
 
Yeah, I just opened the PDF and quickly scrolled through the pages. Looks interesting, I might give it a go
 
it's too short for now. It's more of a draft IMO
 
Forty-something pages, that's not that short, but probably more could be said about the subject, I agree
 
@Shepmaster He should stop everything and change its process into an ISO one
 
Aww, I can't mark a closure as inline.
 
4:05 PM
what ? why would you ?
 
S P E E D
2
 
Nothing important, but I wanted to hint the compiler to emplace the closure body wherever it's called in the same function.
And eh, WebAssembly, as we know, is very slow. Anything to speed it up is bone
yes JavaScript is faster than wasm don't @ me
 
There are as_ref everywhere in my code. As soon as I deal with options I end up having to put as_ref everywhere...
 
as_ref is prepending &s on steroids
 
I suspect the amount of as_ref I have is some kind of code smell
 
4:25 PM
> If there is anythin in commond with another thread pls let me know, I couldn't find one... lol.
O just you wait *searches dupe*
 
4:44 PM
@DenysSéguret specifically because of Option?
 
@Shepmaster option & references
 
I'd say the two main wins are doing it just once if you have an accessor (fn foo(&self) -> Option<&T> instead of fn foo(&self) -> &Option<T>)
and, as mentioned
match &the_option
 
an accessor may help in some cases
 
What's the T in Option<T>?
 
structs...
I say it may be a code smell because there might be too many execution branches with so many optional data
 
4:59 PM
@trentcl odd. I wonder why I didn't catch that last Q in my semi-regular sweep for [rust][cargo]
 
It's only a few days old
 
Oh, well then.
 
@Shep not a good dupe there
 
@E_net4theaccountreporter the wavy?
 
@Shepmaster Aye. The straight underline is not a lint error/warn/hint.
 
5:05 PM
@E_net4theaccountreporter but it's still "how do i make my styles look different", no?
 
@Shepmaster Except that the answers are mostly focused on changing how lint output looks in the editor or disabling lints.
 
@E_net4theaccountreporter Isn't that what they want to do? change how it looks?
 
@Shepmaster How lint output looks, which is not done the same way (see the accepted answer).
And all other answers choose to show how to disable the linter that caused the wavy underline.
 
5:21 PM
Eh.
It's not enough of a hill for me to die on
 
5:58 PM
I like dupes as much as the next person, but this one just ain't it. :)
 
> It's not enough of a hill for me to die on
 
 
1 hour later…
7:18 PM
@DenysSéguret That might be an indication of wrong design decisions -- but not necessarily, it all depends on your case. I know I'm not going to tell you anything that you already don't know, but if you can decide "at the top" of your layers of all the optional things and then you could rely on these decisions later on at the "lower" layers, you might be able to reduce the number of options and therefore branching you must use.
But your problem maybe something totally different and you can't build your abstractions in this "contract driven" way. I think without knowing a lot more about your problem, it is hard to tell whether the design could be simplified, more like, the responsibilities of certain decisions could be pushed higher or this is an actual necessity in your case.
 
8:01 PM
Now... how is a panic coming from get_unchecked_mut
 
8:20 PM
debug mode ?
I would add it in debug mode if it was me
 
@Stargateur but, IIRC, the standard library doesn't have distributed debug / release versions
A constructor should always returned an owned object, so in this case returing a reference indeed doesn't make any sense. — Sven Marnach 11 hours ago
 
8:39 PM
@Shepmaster &Path is std only you can't do it using standard rust
it's a fat pointer
 
@Stargateur oh, I've done it in standard Rust
2
A: How do I handle an FFI unsized type that could be owned or borrowed?

ShepmasterThis appears to work, but it does require using a small unsafe block, so you should test under the normal tools like Miri and Valgrind. The primary assumption made here1 is that c_void cannot be constructed normally. #[repr(transparent)] is used to ensure that the FooBorrowed newtype has the same...

 
well everytime I try to implement borrow I fail
@Shepmaster struct FooBorrowed(c_void); this look wrong
 
 
1 hour later…
10:03 PM
Is there a way to turn a Vec<Result<T>> into Vec<T>? I essentially need to apply the ? operator to all of the elements, but that doesn't quite work. I can use return explicitly IIRC, but is there a more idiomatic way?
Ah nvm, using explicit return returns from the closure, not the outer function, so that's not an option either
Also, it's not a Vec. It's an Iterator and I'm using map, should have clarified that. The map closure is the closure I'm talking about
 
72
Q: How do I stop iteration and return an error when Iterator::map returns a Result::Err?

Kai SellgrenI have a function that returns a Result: fn find(id: &Id) -> Result<Item, ItemError> { // ... } Then another using it like this: let parent_items: Vec<Item> = parent_ids.iter() .map(|id| find(id).unwrap()) .collect(); How do I handle the case of failure inside any of the map ite...

 
@Shepmaster Sickk, thank you
Fun fact I've seen this question before because I already have it upvoted, just forgot about it lol
 

« first day (2170 days earlier)      last day (1305 days later) »