So I had a dream interacting with Wally Darling a while ago-
Was still reeling from it after the next 2 days fr, it’s all kinda blurry now, some details might just be my brain making it up as I type but whatever. (also placed the read more cuz i'm ass at condensing texts & don’t want to make the post too long on dash, either.) cw for some kinda horror description near the end.
Everything felt real, but not at the same time, if that makes any sense. I had my sense of touch and smell, but all of them feels muffled and wonky in some way. Don’t know if dreams are common to have those two senses presence, but anyway-
The dream didn’t take place in the colorful neighborhood, it was a weird place that looked like a hospital and a library smushed together.
The air smelled like old books and antiseptics, a heart moniter from somewhere beeping constantly. There were hallways and doors like hospitals does, but almost all the walls have bookshelves in them.
The room we were in was probably the main reading area. It's spacious, has plenty of those long tables with chairs, there were bookshelves standing in rows near the windows, and some walls were covered in books.
I’m talking about 30cm above ground were all books, almost all the way to the ceiling.
Felt like the books sucked up all the colors, too. Cuz everything was either pure white or some kind of pale color, then the books were all pretty dark & gives off vibes from a medieval painting.
All except Wally, well kinda. His colors were a bit paler than the official art, but still very vibrant compared to everything else.
All the patients (including me) in there wore hospital gowns, there were plenty of them too. All minding their own business, walking to somewhere, looking for books, sitting down to read, or just sitting...but I can’t see their face.
Even if I tried to focus, their face remained a blur. It’s like my eyes just decided to censor them. This includes the doctors, nurses, and a couple librarians I saw. Basically just everyone.
Up until I met him, I was walking towards one of those tables, hugging the two books I picked against my chest.
One of them was a thick, black hardback book with a single big golden eye symbol hot stamped on it, the other one was a colorful children’s book, it was old and covered in clear tapes, felt the tape digging into my skin, too.
Can’t remember much of the book cover other then there’s a chibi version of him near the upper right corner.
So I reached the table, hand on chair about to pull it out, looked up from the books, and there he was. Sitting on the table.
For some reason, he seemed to be made of silicone and metal, his hands and legs were missing, with a bit of wires sticking out and sparks coming out occasionally, but he seemed unaware and was kinda spacing out.
He looked at me 1 second after my eyes are on him. I started talking to him, he replied, this went back and forth for a few moments. Then he lifted his forearms, raptor style, and realized his hands were gone.
He didn’t freak out, he was just like ‘oh’, and got a bit nervous. So I told him to wait and ran off to find any spare parts or tools to help fix him up (I was sure there was a room that has those stuff in the dream).
I never found that room, didn’t see anything useful on my run, too. Then when I ran out of breath and stopped, I found myself back to the reading room. When I went back to the table, he was all fixed up, now sitting criss-cross applesauce on the table.
I approached, fairly baffled, with a “how did you...?” tumbled out of my mouth, trailing off at the end. And all he replied was “found/borrowed them... somewhere else.” or something like that, while turning and opening/closing his hands, testing them out.
Where did Wally find those parts? how did he fix himself up perfectly in a few minutes with no hands?? I’ll never know.
After a few finger wiggles he looked up from his hands, and thanked me for helping him out. His voice was still monotonic as usual, but I felt his gratitude in every single word.
Despite the fact that he did all the work, and I basically ended up chasing my own tail with 0 help provided to him. He’s so damn nice, gosh.
Then one of us started another topic, and I eventually sat back down while still talking. The books long forgotten.
During the conversation, I found out the ‘blurry face curse’ applies to him too, but with some twists. I can see his face when I wasn’t directly looking at him. But whenever I looked at anywhere near his head, his face gets blurred up.
I could only vaguely see where his eyes and mouth is(plus nose when he’s in human form), and the blur made my eyes constantly seeing him in different forms, and positions.
Like, at start he was his classic 3ft puppet look, then he moved his head slightly, now he's human, like how Clown drew him in the Pokemon AU and is now sitting across from me, arms folded on the table.
I spaced out for a second, now he’s back on the table, 3ft again, but in his fleece muppet form. Blinked? He’s across the table again, puppet form and about the same height as me.
At one point during our chat, the blur even made his face kinda looks like Elvis Presley. (Looked up who he is on Wiki just before bed, might be the cause.)
At around 3/4 of the long chat we were having, I held his face in my hands.
He was back in his 3ft puppet form, leaning a bit closer to me than we first met. I don’t know what I was thinking, or even thinked at all. But I stood up from my seat when he was mumbling to himself and looking elsewhere, reached out, and placed both of my hands on his cheeks.
His skin felt like silicone with metal underneath and fleece fabric stuffed with cotton at the same time. A bit disorienting, honestly.
Thumbs were about 2cm below his eyes, and I gently stroked his face once or twice before stopping. That seemed to halt his thoughts abruptly, as his eyes widened a bit, his gaze shot straight back to mine.
A few moments passed, probably processing that I really just went and caressed his face without a word.
Then as I was about to start pulling back from both the confusing texture and the realization kicking in, his response made my brain forgot about them in an almost audible poof:
He closed his eyes, leaned ever so slightly into my left hand, his smile reached his eyes as he let out a few of his unique little laughs. While his hands came up and held mine in place. We stayed like this for a while.
At some point I let go, and he put his hands away, too. Then our chatter started back up again. Now with a bit more positive feelings presence between us.
What officially ended our chat was pretty unexpected, and unpleasant. As it scared us and forced us to find a way out.
The sunlight from outside started to die down, so did the lights from inside too. And that made the staff members starting to act weird.
Everything except their uniform gradually turned pitch black, like they were ate up by the darkest paint in the world. Their body started to drip like tar and emits soot-like particles into the air, some even grew extra limbs or mutates, with razor sharp claws...and spikes.
Also they got more and more aggressive the longer it went on, movements became frantic, thrashing and twitching like those faceless nurses from Silent Hill.
Now ‘corrupted’, they started screaming, yelling, begin to throw stuff around and blocking up the corridors with them. At one point the yelling became clear enough to understand, what I heard were basically ‘block up all the hallways and then start killing’.
The patients started to panic, some of them threw themselves into rooms and locking/blocking up the door, some tried to escape from the windows. But the windows wouldn’t budge, no matter how hard they pried.
Our chatting was cut off by the first shriek, and after we exchanged looks, he hopped off and started speed walking, I got up, went around the table and catching up to him. We held hands as we began to find an exit while trying to remain hidden.
Despite his height, he was surprisingy fast. As I struggled a bit to keep up with his running.
Also he smelled faintly of fresh apples. Noticed it when I was holding his face earlier, but now it became slightly more noticable. For we were now physically a LOT closer than back in the library.
He was mostly leading me around, we hid in somewhere squished together a few times, I even scooped him up and bolted once, because he tripped and a staff was closing in a bit too quickly.
The dream started to end when we were just running, at this point, there wasn’t any obstacles in sight. In fact, the whole building kinda just vanished. No screams, no crashes or bangs, nothing. Just white, but we kept going.
The only sound we heard were our own footsteps, echoing across the now completely white void we’re blindly running in.
And then suddenly, my eyes decided to give out. I didn’t slow down, I didn’t let go of his hand. But my vision just kept getting darker, like the lights going out when a movie is about to start, until finally, the blazing white became inky black.
All of my senses soon went with my vision. I was floating in the void, all alone.
And the next thing I knew, I was staring at my bedroom’s ceiling.
8 notes
·
View notes
What is Async Anyway?
Explaining async/await and general concurrency concepts in programming languages.
A lot of modern languages have async/await syntax built directly into them, and the construct can be extremely useful. Examples of languages that include these concepts are JavaScript, C#, Python, and Swift, and even modern relatively low-level languages like Rust have this syntax. Even though it's usually thought of as a more advanced feature, I think it is really not that hard to use once you get the hang of it, and it is super useful and rewarding when you really understand it.
This is going to be a bit of a long and pretty technical post, but I hope it can give you some confidence to know what async/await really does when you use it, and maybe it can help you use it more effectively. Keep in mind that I will not be able to go over everything in super deep detail, and that I am going to simplify stuff, but it should give you an idea how these systems work.
I am a little curious about eventually following this up with a post looking at how these systems compare under the hood in different programming languages, so let me know if you'd be interested in that.
Big post under the cut.
Parallelism and Concurrency
Computers today can do many things at the same time. And I mean that literally: in one instant, a modern CPU can be working on multiple instructions. That's because a single CPU has multiple cores that can all execute code (mostly) independent from each other.
This is called parallelism, and the way we as programmers interact with that is through threads. Most programming languages, especially "lower level" ones, have a way for programmers to create a thread that will run some part of your code. Creating a thread is telling the computer that it can, and should, run the code in your threads in parallel (although various systems such as the OS still have discretion over when and if that actually happens).
Parallelism is not quite concurrency tho. Where parallelism is about your computer literally doing multiple things at once, concurrency is about your computer doing multiple things, but not at once. With concurrency, you kind of pretend you're doing a parallelism. But in reality, stuff doesn't happen at the same time. Instead, your system (runtime) does some work on task A a bit, then on task B, then maybe again on task A, etc., but doesn't work on the two at the same time. So, in a concurrent system it might look like task A and B are progressing simultaneously from the outside, but work actually only happens in sequence.
Let's Talk About I/O
I/O stands for input/output and describes data in your program that comes from elsewhere, or that gets sent elsewhere.
So for example, user input is I/O. And similarly, a web request can be I/O, whether you send it or receive it. So let's use that as an example: you send a web request to some API to fetch you the cutest bunny images and facts:
But the service is taking its sweet time to respond.
Fact: Loading bunny fact…
With how we did it here, we halt execution of the entire thread until the response comes in (at least in most languages, more on that later). In this case, we call get a blocking method because it, well, blocks the thread without actively doing useful work.
What if we could instead use the thread for other tasks instead of just sitting there, twiddling our thumbs and waiting on the server?
This smells of concurrency…
Callbacks
Callbacks are a way for programmers to avoid that period of thumb twiddling. The new getWithCallback function now returns immediately, but it doesn't return a value. Instead, we have to register the code we want to run once the server responds with the function:
The function we pass to getWithCallback is called the callback, and it gets called by the client* only once the response arrives.
Oh look, here it is:
Fact: A rabbit's life span is about 8 years, though sterilized rabbits (those who are spayed/neutered) can live as long as 10-12 years.
*"The client calls it" is a big simplification, there might be a lot more stuff happening here. But the important bit is that the client magically does not need to block to wait for the response.
Promises and Futures
What JavaScript calls Promises and what a lot of the other languages call Futures is essentially sugar sprinkled on callbacks - it makes our callback code a little nicer. Callbacks can commonly create a concept called "callback hell", where you have to call a function that takes a callback inside the function that takes a callback inside the function that takes a callback…
(Code modified from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises)
To avoid this, functions now can return a Promise instead of taking a callback. Promises represent the promise that, while a concrete value might not exist right now, it will in the future. Once the value exists, we say the Promise resolves. The code above with Promises would then look like this:
It still doesn't look perfect, and there are things you can do to make it look a little nicer, but it's so much less nested. The callback in the then function will be called once the value is ready, and the callback itself can also return a Promise. The then function then returns a Promise which will get resolved once the future from the callback is resolved. Many other languages have a concept similar to JavaScript's Promise, and it's often called something like Future or Task (because it would be too easy to have consistent naming across languages).
Now keep in mind neither of those solutions above are really "concurrency" in the definition we used above. This is because the thread we call, for example, getWithCallback on still completely belongs to us. We could keep using it, and we would not get interrupted to execute the callback. Depending on the language and runtime, the callback might get executed on a different thread, or the runtime might have to wait until we are completely done with what we were doing to then use our thread to call it. The same thing goes for the callbacks in the then method of promises.
Async/Await
And async/await is just some sugar and magic fairy dust on top of Promises (or Futures or whatever). It makes our code look like it should be blocking, but in reality it isn't. Here's what our bunny image code looks like with async/await:
So here, a couple things happen. First, the Promise is created and the web request is initiated. Then, the Promise is awaited. For that, (if the Promise is not resolved at this point already,) the task first yields, meaning it tells the runtime that it is not doing any useful work at the moment, and that the thread it ran on can be used for other tasks. The runtime then makes a note of where to continue execution when that Promise resolves, and looks around for other tasks that currently need executing to put them on that thread. After a while passes, the Promise resolves, and once the runtime has some resources available for us (maybe because another task just yielded), execution on our original task is continued with the API response.
Fact: A rabbit's teeth never stop growing! Many people believe they need to chew to keep their teeth short. While they do enjoy chewing, it's the normal wear from where their top and bottom teeth meet that keeps a rabbit's teeth short.
This is more in line with the concurrency we sought out above. We can interleave other computations while our task is still running, but during times where it is not doing any useful work. (Still, because you may have multiple threads your tasks can run on and move between, it might not always be 100% technically accurate to call this system concurrent.) This is also why it is important to not block for long in async contexts: if you're hogging the thread for too long, you're stopping other tasks from progressing and throwing a lot of the benefits you gained from doing it concurrently in the bin. Most async runtimes will give you some option to run expensive or blocking code elsewhere, so that you can keep the benefits you gain from async.
So that's the explanation what async/await does, and the broad strokes of how it works. If you have any more questions regarding the topic, feel free to ask! I think it'll be fun to occasionally write a longer post on interesting things I've learned, so if you have topic suggestions, don't be afraid to tell me!
Further links and sources
Don't Block The Event Loop! - Why you should avoid blocking in Node.js, and what pitfalls to look out for.
I got the bnuuy images and facts from the animality API. The licenses on the images are not super clear, but I'll assume it's okay for me to use them here with credit because it's an open API.
I lifted the definitions and some of the explanation for parallelism and concurrency from Steve Klabnik's talk on Rust's Journey to Async/Await. The talk is more technical and very focused on Rust, but it's a great talk.
I referenced the mdn web docs at various points, they're a great resource.
I created the code screenshots using the carbon app.
2 notes
·
View notes