« first day (1372 days earlier)      last day (2100 days later) » 

12:42 AM
I was almost in need of venting after this carp.
 
1:35 AM
@E_net4 aww, you think my comment is helpful <3
@E_net4 I don't think they noticed that it was links to a non-stack exchange site, whatsoever.
> no means did I suggest that the linked question was salvageable, but it still is useful
I think your it meant to refer to the comment, but it sounds like you are saying the question was useful; which did you mean?
@PeterHall You want to know what's crazy about this? I think the solution ends up allowing... some crazy things. See also github.com/rust-lang/rust/issues/48055
fn takes_closure(f: FnOnce()) { f(); }
which I still can't quite wrap my head around
 
 
6 hours later…
8:04 AM
@Shepmaster Your comments on that Meta answer are also much appreciated. :)
 
I'm discovering IoC frameworks in C# (I do C# at work). I love the way dependency injection can be done easily (see hypodermic for an example in C++)
I wonder in what extent this is pertinent in Rust, and how it could be done
I read this github.com/KodrAus/rust-ioc and I like the idea, but it is too verbose.
This one is better docs.rs/he_di/0.2.1/he_di but still verbose (we need to anotate the types)
 
 
4 hours later…
11:50 AM
I posted slotmap on reddit, let's see what people think about it :D
 
@orlp Oh good. I was going to ask some questions about it. I'll ask them there instead
 
(if you wish to upvote, or downvote, keep in mind you have to go through reddit.com/r/rust/new, reddit ignores direct link upvotes/downvotes)
@PeterHall were you confused with the term 'key' in crypto?
 
@orlp No. Just like a key in a hashmap, which you often want to be cryptographically secure to prevent certain attacks
 
that's to prevent collision attacks
but that's only because the key depends on the value inserted
and because you can have collisions :P
you can't have collisions in a slot map
and the key does not depend on the value inserted
 
It's not a criticism. More interested in how it works
 
12:04 PM
oh I'm not seeing it as criticism :P
 
But you could carelessly serialise the key and a third party sends it back, incremented, in order to access another user's data
 
@PeterHall that's a silly attack though
 
Silly developer to have the exploit, perhaps
 
that's as silly as http://example.com/reset_password.php?userid=249
 
but developers can be silly :P
 
12:06 PM
'we incremented userid and thus were able to reset other people's passwords'
all I guarantee about (de-)serialization safety
is that there is no undefined behavior
such as accessing uninitialized data
 
anything else can be arbitrary behavior
think about it as if you serialized an array of values
and a couple indices i, j, k
upon deserialization an attacker might have changed the values in the array
and changed i to 19
this is no different
 
yup
Like I said, not a criticism, just curious how it worked
 
I just ensure that sm[k] is safe just like rust would ensure that v[i] is safe no matter what
that might mean sm[k] panics like v[i] would in case i is out of bounds
@PeterHall as for how it works
internally values are stored in an array called slots
when a key is used to access the slot map
we return the value at key.index in the array
but only when key.version == slots[key.index].version
 
Apologies. I started this conversation and now I'm being dragged to lunch. I'm not running away intentionally :)
 
12:12 PM
no worries
just ping me when you have time if you're still interested :)
 
12:33 PM
@orlp Oha... TIL °_°
@orlp Just saw the link on my reddit front page!
 
@LukasKalbertodt haha nice
@LukasKalbertodt it's to make vote manipulation harder
 
@orlp Tell me more about reddit voting: I usually open all of the interesting things on my front page in a new tab. So that's a direct link too, right? So are all of my votes lost then?
 
@LukasKalbertodt no
are you familiar with the 'referer' HTTP attribute?
 
@orlp Yip, ok I see. That solves it ^_^
@orlp Why docs.rs link instead of crates.io or github? Just curious
 
@LukasKalbertodt It has the best description out of all
I mean it was a toss up tbh
 
12:56 PM
@Boiethios Huh. I've never used a toolkit to do dependency injection, I just prefer doing it by hand (creating traits and implementing them).
I've actually mostly heard of people complaining about the frameworks to do it
 
@Shepmaster When you have IFoo than needs IBar that needs IBaz and IQux, it can be cool to say to a framework: Foo implements IFoo, Bar implements IBar, etc. and the framework understand how to resolve the full chain of dependancies.
But I agree that this is mostly useful with a language with full runtime reflexion
Furthermore, Rust does not have constructors, so it cannot be done with the same way as C#
 
1:24 PM
@Boiethios presumably it'd be similar to constructors with more parameters
 
1:42 PM
Mmmmmm... It would require injectables to have a trait implemented. And for most of the IoC frameworks, it'd require the parameter types to be 'known'.
I'm not sure how we could surface that type information to the injector in a programmatic way. I think, like Boe was saying, we'd need some heavyweight reflection that just isn't available in Rust (to my knowledge)
 
@Zarenor But a framework does it in C++ (I didn't have the time to see the sources, tho)
So the runtime reflexion is not a requirement. I guess the framework is doing some type erasure
 
^ procedural macros are getting closer and closer, that might help with boilerplate of stuff like that
 
C++ has RTTI in some form, doesn't it? (Now I'll have to dig into it). rust-ioc from KodrAus (you linked above) certainly looks nice, but it's definitely quite a bit more to set up
Yeah... Rust macroland is still 7-dimensional chess to me.
 
c++ has optional RTTI
IIRC
 
1:57 PM
Having just read up on it (very briefly), it looks like C++s RTTI is mostly used/useful for dynamic typechecking safely. I'm not sure we can't achieve something similar with TypeIdhere, so maybe we can do something similar to the C++ version.
 
@Shepmaster That's the Rust feature I'm the most excited over
@Zarenor The few attempts I saw in Rust had a lot of boilerplate tho
 
2:51 PM
Am I being stupid here? These two implementations of a trait cannot coexist. play.rust-lang.org/…
If I uncomment the other impl, it says "conflicting implementations of trait Concat<char>"
But... if I leave it uncommented then I can't use it with char. I get the error: "the trait bound char: std::ops::Deref is not satisfied"
This doesn't even seem like a case for specialization
 
@PeterHall Yes, hypothetical future upstream implementations of traits are backwards compatible (blanket impls excluded), so this has to be rejected
 
I have a few of these. What's the solution?
impl for every possible concrete type? :S
 
impl<'a> Concat<&'a str> for String
you have to add &* for Box<str> etc. but it's fairly low-impedance
I don't think there's a solution that will work for any Deref<Target = str> as well as char. Barring maybe a future innovation that lets the stdlib explicitly disclaim the possible conflicting impl
 
ok. I was sort of refactoring to try to reduce the number of impls, while ideally being more inclusive
 
3:06 PM
It might be possible with specialization somehow. My imagination is limited in that space
 
What is the question for NLL duplicates?
 
@trentcl Yes, that's not going to happen any time soon though :/
I think, in my case it's actually better to keep the blanket impl for Derefs and expact users to call char.to_string() in that instance
 
 
2 hours later…
5:12 PM
got a lot of positive feedback on slotmap :D
 
slotmap sux
was to restore the balance
 
This isn't the Marvel cinematic universe
 
@Stargateur Is it against the politeness guidelines to say that slotmap is only for idiots?
If so, I won't say it.
 
@PeterHall does say someone is stupid is always insulting ?
 
@Stargateur Using slotmap is always insulting!
Ok I'm finished. Order is restored.
 
5:29 PM
@Shepmaster We are, however, apparently in the DC character universe.
 
@orlp Slotmap actually seems pretty nice.
 
:D
 
oooh
that's a big one
 
@kennytm I'm being lazy; can I use your crate right now to implement docs.rs/jetscii/0.4.2/jetscii 's pattern?
i.e., I already have optional pattern support. would it be useful feedback to try to add optional kennytm pattern support
 
@Shepmaster XD yes (though no stability guarantee)
 
@kennytm sure, sure
I remember being really annoyed at the pattern API
on the implementor side
 
5:56 PM
likely due to SearchStep::Reject
i find that quite unnatural :)
 
I should also try to write stackoverflow.com/a/32257862/155423 with it
@kennytm please write all future RFCs
this is a wonder to read
I'm only skimming at the moment though
 
i'm not familiar with future/async/await though :p :p :p
 
One thing that I think would be great, but I don't have the time to do it, would be technical editors for the RFC
like, typos and misformatted code just shouldn't happen.
 
yeah... the RFC process in other languages involves format editting as the first step
probably could happen when the staged RFC thing is tested :)
@Shepmaster btw after you've done, could you feedback on the RFC to show if the new Pattern API works well for jetscii and this answer, thanks ;)
 
6:14 PM
Do Cows consume Hay?
4
Thank you for allowing me to be the first to make that stupid joke.
It won't be the last.
 
@kennytm yeah, that was my intention!
 
<3
 
 
1 hour later…
7:49 PM
just get censored by a filter language because I wrote "douche" in my language... "shower"
 
en anglais s'il vous plait
 
I do my best ;)
 
8:35 PM
So @Shepmaster can you answer my question, or did not you understand it! — Hasan A Yousef 7 mins ago
 
NLL coming up.
 
@E_net4 NLL?
 
@Shepmaster NLL flag → No Longer Needed
2
As for the question, a Python dev can infer that np.mean means there's a preamble import numpy as np.
 
@E_net4 NLN ?
 
@Shepmaster ... o_o Right.
ded
 
8:38 PM
not that i would have gotten that either. I like you wrote it out tho
 
Too much GANs.
Too much Dune too.
Oh, you're an evil one.
 
@E_net4 I assumed it was such a thing, but I want to be fair about my MCVE comments
 
@Shepmaster Yeah, the question has worse issues beyond this part.
 
@E_net4 It will be true by Rust 2018!
 
@Shepmaster It already is by starring an embarrassing message! :D :x
But now that you mention it, what do you have in mind?
 
8:40 PM
@Shepmaster Rust 9.4669×10⁵⁷⁹⁴
 
@E_net4 I mean the message will be true by Rust 2018 edition
@kennytm I believe you did that in your head
 
@Shepmaster ... Oh!
Right. The chalky thingy, right?
 
@E_net4 but yes, it already is ;-)
 
@Shepmaster I'll live with it.
 
chalk is typeck like GATs. NLL is polonius
 
8:42 PM
@E_net4 rust 2018 will have "plain" NLL to start with. Then Polonius will happen at some point
yeah that ^
chalk == types and traits like an adult
 
I also discovered today that a new consensus emerged regarding float from_bits. So after all this time, it appears to be fine to just transmute to f32.
 
polonius == borrowck like an adult
 
Good to know.
 
> this is incredibly portable
 
> this is incredibly concurrent
 
8:46 PM
𝔹𝕆𝕃𝔻
 
9:11 PM
@E_net4 see, the mod deleted most of the comments :-(
 
@Shepmaster Intriguing. But oh well, it's not like we can salvage this one.
 
9:23 PM
@Shep Ah, nice catch with that edit. :)
I also noticed that this OP has a long history of poorly received questions. :(
 
@E_net4 taking hands into your own things, I see :Р
 
@набиячлэвэли Ctx?
 
Indeed. People were looking for this.
Waffles.
 
@E_net4 that's a thing that I think is a bummer about SO. different tags definitely have different feels to them
That OP had zero, small positive score questions elsewhere
 
@E_net4 I do know, I'm subscribed to that issue and have implemented this manually in the past :v
 
@набиячлэвэли Can you link to one particular implementation of yours? For science?
 
God how I wish I had a good crate that did this, so best of luck
@E_net4 Will see
 
9:45 PM
@набиячлэвэли My aim here is to make it feel like an extension to byteorder just for run-time endianness, no more, no less. Still, there are quite a few API design decisions to make.
So at this phase, seeing how other users have done this is likely to bring useful ideas.
 
@E_net4 Only API you need:
.do_what_i_mean()
.do_what_i_mean_faster()
 
I don't have anything in Rust anymore (the impls were in toys that got dumped on reboot probably) and whenever I needed this in C++ all I needed was big/small (not middle) so something akin to static const is_big_endian = [](){ std::uint16_t data = 1; std:uint8_t test[2]{}; std::memcpy(test, &data, sizeof(test)); return test[1]; }();
 
@Shepmaster But should that be a method or a function?
 
UCS, so no difference :Р
 
^ that
Also impl<T> Trait for T { do_what_i_want }
so that I don't have to think about types
 
9:59 PM
@Shepmaster Why think about types when you can think about what to put in all these dynamic hash mapped objects.
 
impl<T> Trait for T { do_what_i_want(_: impl Any) -> impl Any }
 
10:38 PM
Is there an auto-upvote bot on the latest questions?
 

« first day (1372 days earlier)      last day (2100 days later) »