« first day (1682 days earlier)      last day (1797 days later) » 

7:28 AM
-1
Q: Calculating Square and Cube of a number

Zobia KanwalUsing hard coded number: fn main() { println!("Square of 2 is: {}\nCube of 2 is: {}", square(2), cube(2)); } fn square(num: u32) -> (u32) { num * num } fn cube(num: u32) -> (u32) { num * num * num } Output: Square of 2 is: 4 Cube of 2 is: 8 Using dynamic user input: use std::i...

what is diz... :/
 
not SO material. I commented and voted
 
he wrote an answer, but deleted it... and... things happened :/ I'm confused
thanks for the clarification @DenysSéguret :)
 
Every day I receive some rep from a small set of old trivial answers. Rep per answer should really be bounded, like to something like 1k, especially given that the most profitable answers are usually the ones who were the easiest.
(and I'm all for that change being retroactive, even if it means going back to 50k)
I don't think such proposal would turn well on meta, though
 
7:58 AM
@Shepmaster Are the dark days of reprexion over? We'll soon find out. :)
 
8:09 AM
@DenysSéguret well, that only a problem when one answer/question a very few give you so much rep to be 10/25k
there is some people who have 10k just with one basic (but usefull) answer from 2008
but you have 285k or 50k doesn't matter
maybe a lot of people will agree with you, I agree but I don't feel like it's a problem
 
9:00 AM
Anyways, all this MCVE mess gave me an idea for the Rust Playground. I might file an issue and see if I can work on that once I have the time.
 
 
3 hours later…
11:58 AM
@E_net4 :waiting:
 
12:51 PM
That moment when you s/only stdlib/tokio/g to ask a new question.
:|
 
1:45 PM
@Shepmaster Come to think of it, the proposal could be isolated into a Cargo subcommand first, and then integrated into the playground.
 
@E_net4 still waiting on the idea
 
@Shepmaster Fine: a tool that creates an MCVE. Copyable, in Markdown, prepared with minimal code and compiler errors/outputs if applicable.
 
And the post right before it:
> Honestly, such a tool would be useful beyond just the playground. Bug reports would probably benefit from it as well. (Now I’m wondering if it could be super fancy and be extended to reduce code as well…)
So I agree!
LLVM has the bugpoint tool which is very similar in concept
 
All righty.
 
So, I think this means "yes, the idea is good" :)
 
1:51 PM
I wasn't even thinking about the problem of bundling multiple files into one, but having something that I can copy into a Stack Overflow question/answer and have almost everything I wanted there would be nice.
 
 
5 hours later…
6:29 PM
@Shepmaster do you know why the tasks are always spawning in the same thread ? in this code ?
 
6:57 PM
@ÖmerErden why would they ever be in different threads?
12
A: What is the purpose of async/await in Rust?

ShepmasterYou are conflating a few concepts. Concurrency is not parallelism, and async and await are tools for concurrency, which may sometimes mean they are also tools for parallelism. Additionally, whether a future is immediately polled or not is orthogonal to the syntax chosen. async / await The key...

futures != parallelism
 
@Shepmaster i meant you can create multiple threads for singe core right ?
 
Glad you saw the key reason to not use thread::sleep — it prevents concurrency w.r.t futures
 
@Shepmaster yes thanks for that
 
@ÖmerErden If you mean in general, yes, computers can do that.
Why and where would your code start a thread?
 
@Shepmaster i meant in Rust also
@Shepmaster so lets say you have 1 core device and 4 thread in your Runtime(tokio)'s threadpool. Spawning tasks are in different threads still be considered as parallel ?
 
7:22 PM
What do you mean by “core” here? I thought you meant CPU, but you might mean something else.
 
@Shepmaster nope i meant CPU
 
@ÖmerErden how are you choosing to spawn them into a different thread though?
 
@Shepmaster round robin maybe ?
 
Either way, with a single CPU core and 4 threads, you can have concurrency but not parallelism.
@ÖmerErden I mean in your code; what signals “run this on a different thread”?
 
@Shepmaster yes
Tokio is able to execute and_then blocks in different threads but spawning all in same thread ?
spawning and and_then said for same future *
 
7:36 PM
I actually have no idea when Tokio decides to move a task to a new thread. It states it uses work stealing.
To my understanding, there’s no guarantee which thread will run a given poll
So a single AndThen future might run on all the threads in turn ( the closure can only run once though)
 
8:03 PM
@Shepmaster Probably there is a reason, i believe join_all causes this, it is a root future and the underlying futures also run in same thread, but i just "believe". I have very limited knowledge about Runtime mechanism of Tokio, need a comprehensive book for this, but i guess there isn't any .
 
8:31 PM
posted on May 23, 2019 by The Rust Release Team

The Rust team is happy to announce a new version of Rust, 1.35.0. Rust is a programming language that is empowering everyone to build reliable and efficient software. If you have a previous version of Rust installed via rustup, getting Rust 1.35.0 is as easy as: $ rustup update stable If you don't have it already, you can get rustup from the appropriate page on our website, and check out the

3
 

« first day (1682 days earlier)      last day (1797 days later) »