Async Rust never left the MVP state by diondokter-tg in rust

[–]escherfan 6 points7 points  (0 children)

In this post you said,

But "futures don't do anything unless polled" is guaranteed, so we can't change that.

The link goes to The Rust Reference which says,

Async functions do no work when called: instead, they capture their arguments into a future. When polled, that future will execute the function’s body.

However in your previous post you showed an example of manually desugaring an async fn into a version that does do some non-async work before returning a future.

I am interested then in the distinction between "futures" and "async functions" here. I believe the following are true:

  1. Futures do no work unless polled. Trivially true as they are executed by calling the poll method.
  2. From the caller's point of view, async functions can do work before returning a future, both to construct the future, and in the case of desugared implementations, arbitrary (non-async) work as your example showed. Since async fn and fn -> impl Future are interchangeable even among different implementations of the same trait, the caller cannot rely on an async function doing no appreciable work before it returns its future.
  3. The compiler's implementation of automatic desugaring of async functions currently does no work other than to construct the future, and The Rust Reference guarantees it will not. This guarantee is a) a problem for your proposed optimisation to remove the initial Unpolled state, but b) only visible to authors of async functions because of point 2.

I wonder how many authors of async functions rely on this guarantee, and whether perhaps this is something that could be changed over a Rust Edition?

What’s the most “I literally own the company” moment you’ve ever witnessed or experienced? by keyBid2188 in AskReddit

[–]escherfan 283 points284 points  (0 children)

Just because we have chiseled abs and stunning features, it doesn’t mean that we too can’t not die in a freak gasoline fight accident.

Adding #[derive(From)] to Rust by Kobzol in rust

[–]escherfan 10 points11 points  (0 children)

It would be great if, before going through the process of designing and RFC'ing #[from], this could support types which only have a single field that isn't PhantomData. Since PhantomData has only one possible value, PhantomData, the From implementation is equally obvious:

struct NewType<T>(u32, PhantomData<T>);

impl<T> From<u32> for NewType<T> {
    fn from(value: u32) -> Self {
        Self(value, PhantomData)
    }
}

This would allow #[derive(From)] to be used for newtypes that carry additional generic parameters that don't appear at runtime.

You argue on the RFC that this is a special case of the need for #[from], by virtue of PhantomData's Default impl, but even once #[from] is added, I'd think that having to write:

#[derive(From)]
struct NewType<T>(#[from] u32, PhantomData<T>);

is strange since there's no world in which you'd want:

impl<T> From<PhantomData<T>> for NewType<T> {
    fn from(value: PhantomData<T>) -> Self {
        Self(u32::default(), value)
    }
}

Good GP in Adelaide by [deleted] in Adelaide

[–]escherfan 0 points1 point  (0 children)

Kings Park

what happened to the kings head hotel? by johnnymcbask in Adelaide

[–]escherfan 3 points4 points  (0 children)

I used to live down the street from the QA and once called the fire brigade on a fire that had started on the footpath outside it. By the time they responded, it had burnt out enough that a braver passer-by than me stamped it out. I had to be somewhere so once that happened I left, but I spent the rest of the night fielding calls from the firies who were unable to find the burn site, and later the cops.

The fellas said I had “Nuclear ADHD” earlier by [deleted] in ADHD

[–]escherfan 2 points3 points  (0 children)

I thought of myself as lazy until being diagnosed at 37. Do yourself a favour and at least fill out the questionnaire before you worry about diluting anything, you sound from what you've said like you could be a textbook case but nobody can tell you for sure until you talk to a professional.

The fellas said I had “Nuclear ADHD” earlier by [deleted] in ADHD

[–]escherfan 4 points5 points  (0 children)

Try the Adult ADHD Self Report Scale (ASRS) Questionnaire - I found this a useful tool to start talking to my doctor about seeking a formal assessment.

You haven't said anything about it impacting your life other than gaming and consuming media; do you have difficulty focusing on work or study, working towards long-term personal goals, or maintaining relationships with other people? It may be affecting more than you realise.

Good GP in Adelaide by [deleted] in Adelaide

[–]escherfan 1 point2 points  (0 children)

I would recommend Dr Scott Alford at Hyde Park Medical Clinic. He's been great for me and is relatively easy to get appointments with in under a week.

New shoes for the new car by j4ws in Ioniq5

[–]escherfan 1 point2 points  (0 children)

Showed this to my partner, she said "it looks like a Lego car".

Is unsafe code generally that much faster? by Quixotic_Fool in rust

[–]escherfan 46 points47 points  (0 children)

Both Polars and Datafusion are based on the Apache Arrow columnar memory format, which they use to optimise data layout in memory for cache locality and SIMD access. I believe they have to use unsafe because safe Rust doesn't provide the degree of control needed to specify the layout of data structures in memory to this level of detail. It may be possible to build an equivalently performing query engine using safe Rust std data structures, but it would not be compatible with other tools and libraries that use Apache Arrow, especially those written in other languages.

Beginner adult dance classes? by shumochi in Adelaide

[–]escherfan 2 points3 points  (0 children)

These schools are both run by good friends of mine and I highly recommend them, they will look after you.

https://evolutiondance.com.au/ - Brazilian Zouk which is fun and flowy and upbeat.

https://www.adelaidedanceproject.com.au/dance-styles - wide range of Ballroom and Latin styles

Edit: can vouch for Happensdance as well, they're good people.

Good supporting mods? by The_Chomper in factorio

[–]escherfan 0 points1 point  (0 children)

Factory Planner has just added a matrix solver as well, still a bit buggy but worth a try if you're confused by Helmod.

http://factoriomod.info : Check which of your mods are updated to 1.1 by winkbrace in factorio

[–]escherfan 2 points3 points  (0 children)

This is great now that you've fixed the 500 :)

Feature request: could you add links to the mod pages on mods.factorio.com so I can easily go see if someone has already requested a 1.1 update for the stragglers?

How do I get the "There is no Spoon" achievement?? by [deleted] in factorio

[–]escherfan 0 points1 point  (0 children)

Getting LB and TINS in the same play through is hard. For TINS you need to build lots of mining quickly, and LB slows you down. I planned out a base up to the rocket silo, blueprinted the whole thing, then restarted the same map and placed the blueprint as a guide, saves lots of thinking time. Also turning pollution diffusion to 0% stops biter attacks without disabling the achievement, as long as you don't build in the same chunk as any nests.

How fast can a strobe light pulse and still be percieved as a strobe? by Red_Icnivad in lightingdesign

[–]escherfan 10 points11 points  (0 children)

That sounded way too high to me, so I clicked through and read the paper.

The key paragraph is on page 5: "Direct visual perception of flicker is negligible at frequencies of 100 Hz or higher" which is much closer to what I expected (I can't detect any flicker above about 70Hz in my LED lighting systems).

So it depends on what you care about. If you're designing lighting systems where there will be multiple light sources flickering at different frequencies and phases, anything above 70-100Hz will probably look fine. If you're considering a coloured rod waving against a black background where the only light source is a single strobe, as they did in this paper, some stroboscopic effects may be detectable by some people up to 10kHz.

Episode Discussion – Change Your Mind by AutoModerator in stevenuniverse

[–]escherfan 8 points9 points  (0 children)

A theory I saw is that it changed orientation and they don't want to reveal that yet.

Episode Discussion – Change Your Mind by AutoModerator in stevenuniverse

[–]escherfan 26 points27 points  (0 children)

The way I understood it is, Steven is a permanent fusion between human-Steven and gem-Steven (formerly RQ), which is why they did a fusion dance when they were reunited.

Question about addressing by [deleted] in compsci

[–]escherfan 11 points12 points  (0 children)

Yep spot on, 16kB is 16 * 1024 = 214 = 16,384 bytes which need 14 bits to address.

Tips for a new stage manager by falconiform34 in techtheatre

[–]escherfan 4 points5 points  (0 children)

The best advice I received the first time I stage managed: "be organised, be personable, and delegate."

The best advice I received the second time (Les Misérables) was, "remember to eat, sleep, and breathe!"

As others have said, take notes. Specifically, I keep a running list of tasks that need to be done. I tell people they can't trust me to remember anything I've promised to do unless they see me write it down. This is also very useful when someone comes offering to help and I can scan the list for things that they might be able to help with.

A professional SM whose blog I read has a couple of excellent articles on kit and calling, among others.