« first day (1863 days earlier)      last day (1608 days later) » 

1:33 AM
@Zarenor Could do trait Trait: T + R + A + I + T {}
 
 
1 hour later…
2:52 AM
I can make bad code easier now
fn foo(
    #[cfg(target_os = "linux")] a: i32,
    #[cfg(target_pointer_width = "64")] b: bool,
) {
    // A bad idea
}
 
3:40 AM
to surprise your enemy you need to surprise your ally ?
 
 
10 hours later…
1:55 PM
Wait. That's a fn with conditionally, 0, 1, or 2 arguments?
That's why we can't have nice things.
 
@Zarenor That's right!
 
2:30 PM
Howdy @loganfsmyth! How's things?
 
3:16 PM
No, I deleted it because on SO, somebody always seems to obtusely take issue with some detail, and ignore the spirit of the question, which results in downvotes, close votes, and lost rep. It's not worth the effort. Thank you for the link, and for your help :) — Alex 4 mins ago
@PeterHall ^
 
3:43 PM
guess we are monster to ask code that compile when the question is not about compile problem
 
@Stargateur I'm with the OP on this though. If they were able to get it to compile, they probably would have solved the problem
They demonstrated what they wanted and showed their attempt
 
oh it's a compile problem ?
 
Woa, 5,000 + issues 0__0 github.com/rust-lang/rust/issues
 
I'm not sure I follow...
 
@Shepmaster well peter is right some error are just too easy to fix
 
3:47 PM
Some of the errors, sure (really only " expected unit struct/variant or constant" here)
and maybe the type / unwrap one
but the collect and yield related errors are part of the core problem.
In Python, you can call yield and make an iterator
so OP called yield and thought they were making an iterator of Value (I'm guessing a bit here)
 
@Zarenor We already have plenty of nice things, don't you think?
 
***IT'S NEVER ENOUGH***

/s
But in a bit more seriousness, I'm just bandwagoning on Shep's decrial of abusing things that are technically allowed in ugly ways
like a trait named Trait which requires two other traits named Trait, because "Trait" is an accepted identifier name
Or a fn that takes arbitrary numbers of arguments based on OS or pointer width
 
4:07 PM
@Zarenor That's not abuse, that's what I would expect from the "conditional compilation" feature in any language that is capable of doing such a thing
 
I'm not saying it's not useful. Just that absurd examples are absurd. Hence the joking.
I've got a file (written in C#) where the conditional compilation flag changes the base type of a class, and the signature of a method override, so I could easily test some functionality in an API I don't control. I'm not saying conditional compilation is bad. Just that absurd cases are absurd (and funny to mock!)
 
What's an actual use of conditional compilation that changes the function arguments / return types?
 
@Shepmaster The example they give is about strings IIRC
utf16 in Windows, utf8 in other OSes
 
@Stargateur In this case, it was clear OP had taken the python code and then attempted to convert it to Rust token by token. It just doesn't work like that
 
4:25 PM
@PeterHall yes clearly
and ofc ask to people to help
SO should not be automatic
@FrenchBoiethios don't confuse UTF16 and WTF16
 
@Shepmaster In my case? As mentioned, overriding different base class types. The implementation is the same, but I get what is argument data in one sig from properties of the type in the other sig.
 
So, for "quick hack to see if the code compiles", anything goes, IMO
but for something like that, I'd go with a type
 
Elsewhere? I'd expect different OS primitives. If you try to paper over them carefully, you might be able to use conditional compilation to handle some of that. But I feel like we typically
exactly
In rust, we'd use a type or enum to abstract that another layer, and try to push that complexity to whole functions conditionally compiled and used. (IME/IMO)
 
I even go with whole modules.
I like the pattern of
#[cfg(a)]
mod a;
#[cfg(a)]
use a::*;

#[cfg(b)]
mod b;
#[cfg(b)]
use b::*;
and the public items of the modules match up
 
I do this all the time
 
 
1 hour later…
5:44 PM
"I cannot find any documentation how to get around it." literally the second sentence of the doc XD "By default, stdin, stdout and stderr are inherited from the parent."
 
6:01 PM
@Stargateur that sentence doesn't directly state how to fix the problem
 
@Shepmaster but there is no problem...
 
@Stargateur sure there is — they want the second program execution time to take << 8 seconds
 
guess .stdout(Stdio::null()) will do it
 
 
1 hour later…
7:26 PM
Hi, I am following the book and I came across a time they iterate through a vec with the use of .iter(). I used the & character instead of the iter() and it did also compile. Is there any difference in using one of the two? Code example: play.rust-lang.org/…
 
@J.Doe nope
2
Q: What does it mean to pass in a vector into a `for` loop versus a reference to a vector?

AnaI'm confused by how Rust for loops work. Consider the following: #![feature(core_intrinsics)] fn print_type_of<T>(_: T) { println!("{}", unsafe { std::intrinsics::type_name::<T>() }); } fn main() { let nums = vec![1, 2, 3]; for num in &nums { print_type_of(num); } for num in n...

 
Thanks :)
 

« first day (1863 days earlier)      last day (1608 days later) »