Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Search - "async/await"
-
At my old company one of my colleagues introduced async / await into our csharp code. He created interfaces and showed us a great structuring of his code. Sadly a few weeks later he left the company, because of personal reasons and a bug appeared in his written service. Our senior developer took the issue and complained for like 1 week. That you can't find anything, that interfaces are useless, that async / await is slow and sucks and that we should stop trying to bring new structures into the code base and do things the old way. In the end he deleted all the great things that my colleague introduced and wrote bad and smelly code.9
-
Manager: You can’t define an async function without using await.
Dev: Yes you can.
Manager: Well you shouldn’t, there’s no point!
Dev: Yes there is. It can turn blocking synchronous logic into work performed concurrently. In this case the perform—
Manager: It’s called async *await*. Async *AWAIT*! Did you hear the two parts to that? You shouldn’t ever have one without the other. THEY GO TOGETHER. Worrying about concurrency is for people who use callbacks which just goes to show how out of date your skills are. I’m reading a book on javascript and there are so many advanced techniques out there that I haven’t even seen you use ONCE!
Dev: …
*I looked at the book he’s reading, it’s from the < ES6 era… no wonder he doesn’t see me using any of those archaic patterns/hacks/workarounds…*13 -
Found my most ridiculous function ever, back from when I was first learning.
async Task Delay(int time)
{
await Task.Delay(time)
}1 -
When I write async code in ES7, I'm tempted to call my promises "chtulu", "messiah", "lastJudgement", etc.
async function doStuff() {
chtulu = someAsyncTask();
await chtulu;
}5 -
Oh man. Mine are the REASON why people dislike PHP.
Biggest Concern: Intranet application for 3 staff members that allows them to set the admin data for an application that our userbase utilizes. Everything was fucking horrible, 300+ php files of spaghetti that did not escape user input, did not handle proper redirects, bad algo big O shit and then some. My pain point? I was testing some functionality when upon clicking 3 random check boxes you would get an error message that reads something like this "hi <SENSITIVE USERNAME DATA> you are attempting to use <SERVER IP ADDRESS> using <PASSWORD> but something went wrong! Call <OLD DEVELOPER's PHONE NUMBER> to provide him this <ERROR CODE>"
I panicked, closed that shit and rewrote it in an afternoon, that fucking retard had a tendency to use over 400 files of php for the simplest of fucking things.
Another one, that still baffles me and the other dev (an employee that has been there since the dawn of time) we have this massive application that we just can't rewrite due to time constraints. there is one file with (shit you not) a php include function that when you reach the file it is including it is just......a php closing tag. Removing it breaks down the application. This one is over 6000 files (I know) and we cannot understand what in the love of Lerdorf and baby Torvalds is happening.
From a previous job we had this massive in-house Javascript "framework" for ajax shit that for whatever reason unknown to me had a bunch of function and object names prefixed with "hotDog<rest of the function name>", this was used by two applications. One still in classic ASP and the other in php version 4.something
Legacy apps written in Apache Velocity, which in itself is not that bad, but I, even as a PHP developer, do not EVER mix views with logic. I like my shit separated AF thank you very much.
A large mobile application that interfaced with fucking everything via webviews. Shit was absolutley fucking disgusting, and I felt we were cheating our users.
A rails app with 1000 controller methods.
An express app with 1000 router methods with callbacks instead of async await even though async await was already a thing.
ultraFuckingLarge Delphi project with really no consideration for best practices. I, to this day enjoy Object Pascal, but the way in which people do delphi can scare me.
ASP.NET Application in wich there seemed to be a large portion of bolted in self made ioc framework from the lead dev, absolute shitfest, homie refused to use an actual ioc framework for it, they did pay the price after I left.
My own projects when I have to maintain them.9 -
JavaScript Motherfucking Asynchronous Bullshit.
I get it, for quite some stuff, async is very, very useful. But why on fucking earth do so goddamn many functions NEED this (and those callback functions) and can't do without?!
If there would be good and nicely understandable await documentation that actually fucking works, I'd be so happy.
I've currently got .then after .then after motherfucking then and its irritating me to no end as it, in this context, shouldn't even be necessary. This thing I'm writing doesn't give a fuck if something takes a few milliseconds before the rest of the program can continue!!
Fuck asynchronous programming in JavaScript for goddamn everything.
(I do love JavaScript!)27 -
First rant: but I'm so triggered and everyone needs a break from all the EU and PC rants.
It's time to defend JavaScript. That's right, the best frikin language in the universe.
Features:
incredible async code (await/async)
universal support on almost everything connected to the internet
runs on almost all platforms including natively
dynamically interpreted but also internally compiled (like Perl)
gave birth to JSON (you're welcome ppl who remember that the X in AJAX stood for XML)
All these people ranting about JS don't understand that JS isn't frikin magic. It does what it needs to do well.
If you're using it for compute-heavy machine learning, or to maintain a 100k LOC project without Typescript, then why'd you shoot yourself in the foot?
As a proud JS developer I gotta scroll through all these posts gushing over the other languages. Why does nobody rant about using Python for bitcoin mining or Erlang to create a media player?
Cuz if you use the wrong tool for the right job, it's of course gonna blow up in your face.
For example, there was a post claiming JS developers were "scared" of multithreading and only stick in their comfort zone. Like WTF when NodeJS came out everything was multithreaded. It took some brave developers to step out of the comfort zone to embrace the event loop.
For a web app, things like PHP and Node should only be doing light transforms between the database information and HTML anyways. You get one thread to handle the server because you're keeping other threads open to interface with databases and the filesystem. The Nexus.js dev ranting on all us JS devs and doesn't realize that nobody's actual web server is CPU bound because of writing HTML bodies, thats why we only use 1 thread. We use other worker threads to do the heavy lifting (yes there is a C++ bridge look it up)
Anyways TL;DR plz respect JS developers we're people too. ES7 is magic and please don't shit on ES3 or we'll start shitting on the Python 2-3 conversion (need to maintain an outdated binary just cuz people leave out ()'s in their print statements)
Or at least agree that VB.NET is an abomination and insult to the beauty that is TI-84 BASIC13 -
Did you fucking idiots think that I was gonna tell you to implement async await on the requests and not notice that you IMPLWMENTED GODDAMN SYSTEM-SLEEP YOU DESNE MOTHERFUCKEDS IT NOT TAKES 10X AS LONG AS MY OATCH TO JUST LIMIT THE NUMBER IF HTTP REQUESTS FOR FUCJS SAKE THIS CODE LOONS LIKE A RACCOON FUCKED AN MACBOOK THAT ALSO GOT FUCKED BY A GOAT FROM CHERNOBYL THAT SOMEHOW MUTATED TO A RACCOON GOAT 🐐 MACBOOK 💻 HYBRID ABOMINATION THAT IS NOW CLAWING MY EYES OUT AND GIVING ME RABIESCANCERAIDS5
-
I've been using microsoft dev stack for as long as i remember. Since I picked up C#/.NET in 2002 I haven't looked back. I got spoiled by things like type safety, generics, LINQ and its functional twist on C#, await/async, and Visual Studio, the best IDE one could ask for.
Over the past few years though, I've seen the rise of many competing open source stacks that get many things right, e.g. command line tooling, package management, CI, CD, containerization, and Linux friendliness. In general many of those frameworks are more Mac friendly than Windows. Microsoft started sobering up to this fact and started open sourcing its frameworks and tools, and generally being more Mac/Linux friendly, but I think that, first, it's a bit too late, and second, it's not mature yet; not even comparable to what you get on VS + Windows.
More recently I switched jobs and I'm mainly using Mac, Python, and some Java. I've also used node in a couple of small projects. My feeling: even though I may be resisting change, I genuinely feel that C# is a better designed language than Java, and I feel that static type languages are far superior to dynamic ones, especially on large projects with large number of developers. I get that dynamic languages gives you a productivity boost, and they make you feel liberated, but most of the time I feel that this productivity is lost when you have to compensate for type safety with more unit tests that would not be necessary in a static type language, also you tend to get subtle bugs that are only manifested at runtime.
So I'm really torn: enjoy world class development platform and language, but sacrifice large ecosystem of open source tools and practices that get the devops culture; or be content with less polished frameworks/languages but much larger community that gets how apps should be built, deployed, monitored, etc.
Damn you Microsoft for coming late to the open source party.11 -
Ooh, look! Node got async/await!
Ooh, look! I can lint shell scripts with shellcheck!
Ooh, look! Webpack 2 has been released!
Ooh, look! I can switch over from npm to yarn!
There is so much stuff I want to upgrade and optimize in our project, that I forget about the actual JIRA ticket.7 -
A co-worker doesn't like to use async/await operators, so he's always changing the code to use promises and callbacks and apparently async functions whitout awaits...1
-
Wanna hear a story? The consultancy firm I work for has been hired to work on a WPF project for a big Fashion Industry giant.
We are talking of their most important project yet, the ones the "buyers" use to order them their products globally, for each of the retail stores this Fashion giant has around the world. Do you want to know what I found? Wel, come my sweet summer child.
DB: not even a single foreign key. Impossibile to understand without any priopr working experience on the application. Six "quantity" tables to keep aligned with values that will dictate the quantities to be sent to production (we are talking SKUs here: shoes, bags..)
BE: autogenerated controllers using T4 templates. Inputs directly serialized in headers. Async logging (i.e. await Logger.Error(ex)). Entities returned as response to the front end, no DTOs whatsoever.
WPF: riddled with code behind and third party components (dev express) and Business Logic that should belong to the Business Layer. No real api client, just a highly customized "Rest Helper". No error reporting or dealing with exceptions. Multiple endpoints call to get data that would be combined into one single model which happens to be the one needed by the UI. No save function: a timer checks the components for changes and autosaves them every x seconds. Saving for the most critical part occurring when switching cells or rows, often resulting in race conditions at DB level.
What do you think of this piece of shit?6 -
I've been working on a proof of concept for my thesis for a few days and the async query calls drove me nuts for quite a while. I finally managed to deliver all query results asynchronously while still very much relying on a strong architectural design pattern. I am filled with caffeine, joy and a sense of pride and accomplishment.rant late night coding caffeine async await query proof of concept javascript boilerplate database typescript1
-
!rant
Goodbye Java I will not miss you at all! I swear ...
I do like it when making web services (especially that I can use Java8) but for Android you have been a torture. Hello sweet Kotlin! I shall embrace you and treat you like my newly born baby!!
Story is:
Working on a new project where I need to talk to a web service (also made by me).
Started writing in Java, all is cool and unit tests pass.
Downloaded Android Studio 3 Beta 1 and converted my Java code to Kotlin, That AsyncTask did not look nice in kotlin, converted it to async & await feature and I must admit lots of code removed, no more need to create a new fucking AsyncTask every time the app sneezes for data!
I feel like I'm working with C# but with difference in syntax.
My life is now complete :)undefined java goodbye! am i drunk? koline: sorry i have a boyfriend hi there kotlin i shall not miss you what the fuck did i just use for a tag?8 -
TL;DR C# has changed quite a bit since the last time I used it.
So I'm working on a personal project, it's written in C#. When I needed to run a task on a separate thread. It has been years since the last time I worked with C#, so I googled it.
Me: "Async? Await? Task? This looks pretty fucking useful. When was this added?"
*Googles a bit*
Return .NET 4.5 in 2012. Current version 4.7.1.
Me: "What?! Last time I checked they were still in .NET 4. Shit!"
I've got a bit of catching up to do.2 -
I was just chatting with my dad. He used to be mostly a C# dev but changed jobs and is now doing mostly Java. He says he likes it better.... Because it doesn't have lambdas/anonymous functions.
Uh.... Java was the first and only language where you can define interface implementations in-line (aka a whole bunch of functions)...
And 1.8 supports lambdas for Interfaces that have a single function...
I bet he'll hate JS... Where functions are can be passed around like objects, ES6 now supports lambdas and await, async... and anonymous functions (apparently they're called arrow functions?)9 -
Im now working as a fulltime dev for 3 years. I do programming since im 9 and now that I collected some experience, I have to to say, its horrible. Seriously. What the fuck is wrong with german internship companys? Letting me do 3 years of FUCKING CRYSTAL REPORTS. IN A DEVELOPMENT TEAM THAT CONSISTS OF A TEAM LEAD THAT ACTUALLY HAS TO LEARN SHIT LIKE PROPER OOP AND ASYNC/AWAIT FROM ME. THEY EVEN ASKED ME IF I CAN DROP OF MY HOBBY PROJECTS TO WORK ON SAMPLES THAT THEY CAN LEARN FROM! NO! FUCK! JUST BECAUSE THESE DOUCHBAGS ARE TOO LAZY TO FUCKING LEARN TECHNOLOGY THEY SHOULD BE PASSIONATE ABOUT IN THEIR FREE TIME, IM NOT MAKING IT MY JOB TO FREAKING SHOW THEM THAT HAVING A STATIC CLASS CONTAINING ALL MODELS EVER EXISTED IN THE APP IS A BAD THING! SERIOUSLY, THERES ONLY ONE INSTANCE OF EVERY MODEL WE HAVE! AND THEN THEY BLAME SQL SERVER FOR RACE CONDITIONS WHEN TRYING ASYNC!!!! WHAT THE FUCK!! AND STILL, IF I TELL THEM WHATS WRONG, IM AN IDIOT BECAUSE IM A JUNIOR! Please tell me that i didnt waste 10 years of my life dedicating to such bullshit. Will that change? Is it company specific?9
-
I need to delay execution of code in a for loop, how do I do that?
PHP: Sleep(3000)
Javascript:
const waitFor = (ms) => new Promise(r => setTimeout(r, ms))
const asyncForEach = (array, callback) => {
for (let index = 0; index < array.length; index++) {
await callback(array[index], index, array)
}
}
const start = async () => {
await asyncForEach([1, 2, 3], async (num) => {
await waitFor(50)
console.log(num)
})
console.log('Done')
}
start()
Fuck you Javascript17 -
I just want to throw out there for Javascript developers, async and await are the two best things to ever happen to promises.3
-
So, I've had a personal project going for a couple of years now. It's one of those "I think this could be the billion-dollar idea" things. But I suffer from the typical "it's not PERFECT, so let's start again!" mentality, and the "hmm, I'm not sure I like that technology choice, so let's start again!" mentality.
Or, at least, I DID until 3-4 months ago.
I made the decision that I was going to charge ahead with it even if I started having second thoughts along the way. But, at the same time, I made the decision that I was going to rely on as little external technology as possible. Simplicity was going to be the key guiding light and if I couldn't truly justify bringing a given technology into the mix, it'd stay out.
That means that when I built the front end, I would go with plain HTML/CSS/JS... you know, just like I did 20+ years ago... and when I built the back end, I'd minimize the libraries I used as much as possible (though I allowed myself a bit more flexibility on the back end because that seems to be where there's less issues generally). Similarly, any choice I made I wanted to have little to no additional tooling required.
So, given this is a webapp with a Node back-end, I had some decisions to make.
On the back end, I decided to go with Express. Previously, I had written all the server code myself from "first principles", so I effectively built my own version of Express in other words. And you know what? It worked fine! It wasn't particularly hard, the code wasn't especially bad, and it worked. So, I considered re-using that code from the previous iteration, but I ultimately decided that Express brings enough value - more specifically all the middleware available for it - to justify going with it. I also stuck with NeDB for my data storage needs since that was aces all along (though I did switch to nedb-promises instead of writing my own async/await wrapper around it as I had previously done).
What I DIDN'T do though is go with TypeScript. In previous versions, I had. And, hey, it worked fine. TS of course brings some value, but having to have a compile step in it goes against my "as little additional tooling as possible" mantra, and the value it brings I find to be dubious when there's just one developer. As it stands, my "tooling" amounts to a few very simple JS scripts run with NPM. It's very simple, and that was my big goal: simplicity.
On the front end, I of course had to choose a framework first. React is fine, Angular is horrid, Vue, Svelte, others are okay. But I didn't want to bother with any of that because I dislike the level of abstraction they bring. But I also didn't want to be building my own widget library. I've done that before and it takes a lot of time and effort to do it well. So, after looking at many different options, I settled on Webix. I'm a fan of that library because it has a JS-centric approach. There's no JSX-like intermediate format, no build step involved, it's just straight, simple JS, and it's powerful and looks pretty good. Perfect for my needs. For one specific capability I did allow myself to bring in AnimeJS and ThreeJS. That's it though, no other dependencies (well, at first, I was using Axios because it was comfortable, but I've since migrated to plain old fetch). And no Webpack, no bundling at all, in fact. I dynamically load resources, which effectively is code-splitting, and I have some NPM scripts to do minification for a production build, but otherwise the code that runs in the browser is what I actually wrote, unlike using a framework.
So, what's the point of this whole rant?
The point is that I've made more progress in these last few months than I did the previous several years, and the experience has been SO much better!
All the tools and dependencies we tend to use these days, by and large, I think get in the way. Oh, to be sure, they have their own benefits, I'm not denying that... but I'm not at all convinced those benefits outweighs the time lost configuring this tool or that, fixing breakages caused by dependency updates, dealing with obtuse errors spit out by code I didn't write, going from the code in the browser to the actual source code to get anywhere when debugging, parsing crappy documentation, and just generally having the project be so much more complex and difficult to reason about. It's cognitive overload.
I've been doing this professionaly for a LONG time, I've seen so many fads come and go. The one thing I think we've lost along the way is the idea that simplicity leads to the best outcomes, and simplicity doesn't automatically mean you write less code, doesn't mean you cede responsibility for various things to third parties. Those things aren't automatically bad, but they CAN be, and I think more than we realize. We get wrapped up in "what everyone else is doing", we don't stop to question the "best practices", we just blindly follow.
I'm done with that, and my project is better for it! -
People around me and clients are increasingly saying i am a genius, because i show them an app i made in react-native or some crappy site i set up in a week as POC.
While im quite noobish still, i barely read publications out of interests, and most of the time i just put in async/await somewhere just to see if it makes the promise work or not, because i dont understand promises fully, and I think in general i just accomplished very little in the 5 years I have been programming
It is really putting pressure on my impostor syndrome, even more when i talk with my peers who can tell who was the driving force behind ES6 :/9 -
JavaScript is new the PHP.
Reading a stackoverflow question about async functions and await-usage, and lot of well-intended answers show no understanding of the concept. Some fail to understand that the scope is about promises. They don't know that, yes, *every* async function *always* returns a Promise and that within an async function it's synctically the same to do either `return x` or `Promise.resolve(x)` or `return new Promise((resolve) => {resolve(x)}), and they fail to realize what await does or doesn't do and are oblivious about how awaiting at certain stages can have huge performance impact when compared to either Promise.all or Bluebird.map.
Grasping promises is hard in the beginning, I get that. But please don't share your lack of understanding as fact. -
Just got started with nodejs and I never thought I’d have to use async/await this early. Concurrency seemed like a far fetched thing. Feeling like a boss😎1
-
I don't want to ever hear that you're proficient in JavaScript if you put a callback function call inside of an async function right after using the await command.
All you manage to do in the end was make a simple function that gets data to populate a dropdown menu into something that is absolutely more awful to look at than the worst callback hell possible.
Refactoring this code base has really questioned my sanity and how much I'm willing to spend on alcohol.4 -
The problem: callback hell. Code would be indented by three hundred fucking spaces just to do some async work. Your code would end with thirty lines of closing curly brackets
Solution: async and await.
The problem, reborn: NoSQL. Code is indented by three hundred fucking spaces just to run a query. Your query ends with thirty lines of closing curly brackets.4 -
```
public someMethod(index: string): Promise<void> {
return Promise.resolve(someAsyncFunction().then(() => {
return;
})
.catch((error) => {
this.logger.error(error);
throw error;
});
```
Somebdoy doesn't know their async / await syntax but they wanted aboard the promise-hype train. There is an entire class in that style.1 -
I'm still using .then().catch() instead of the async await.
So, first of all, Fuck you for calling it a STANDARD now. its nowhere near to be called standard. You wanna get some data from an API? Wanna call it using axios or fetch? What if the server is down? what if there's an error that you don't even know existed? Where do I get that kinda error in async await? try-catch? no thanks :| I'm good -_-8 -
I am working on an AoK bot. It worked before but now it fails on me. It says: {'success': False, 'error': 'Invalid comment.'}
I don't know why.
This is the comment: "@retoor debugsemiss everything and nave the and resorts they're not paying much to clean a fucking roomic lolg creating of my phoprooting such is the quoting this kidle... Noh ot inuforian times fined the apposivy suistlondlan't by imprymarbygind. Metwary nate ?"
Call method:
```
async def post_comment(self, rant_id, text):
payload = dict(
rant_id=rant_id,
comment=text
)
payload.update(self.auth_params)
async with self.session.post(f'/api/devrant/rants/{rant_id}/comments',data=payload, params=self.auth_params) as resp:
print(await resp.json())
```
Someone has an idea why it's failing? Also tried it with hardcored rant_id and message.23 -
Til that Node 10 has `for await ... in`. Basically looping async iterators. This changes everything!5
-
So if you’re awaiting a promise and the async function returning the promise calls another async function and doesn’t await it could this counterintuitively cause the whole thing to freeZe ?14
-
I can't get over the fact that my company downgraded the project from Elixir Phoenix to nodejs express.
I asked them why, they told me, the elixir is difficult and blablabla. In my resume, I did mention I have the experience for 2 and a half years (phoenix one year) , I can do that. and previously the senior here used elixir for scalibility , etc. Personally, the system he built weren't bad at all.
now in nodejs , with the async await promise shit.
but 'we prefer old tech' they say . old is gold they say .
Wait nodejs isn't old. To me elixir is like Ruby and Erlang had sex and gave birth to it and named it elixir.5 -
Going over some NodeJS code, and I feel like the scene from "Dude Where's My Car" - "And then....And then..."
Coming from almost three years of 99% python, this hurts my eyes so much1 -
Yesterday a colleague of mine made a post on our company's workplace about receiving for the 3rd time the mvp award for .net. Today she wasn't able to explain Async await behavior to a junior dev. Nothing against it, just saying.
-
TL;DR: don’t use Array.forEach use
for … of … instead.
Array.forEach is synchronous, but pass it an async function and the bastard does not await it.
I was so sure that it was sync….
Wasted 2h14 -
There is a Facebook group I’m a part of called “ReactJS Expert Community” and I can tell you it’s filled with anything but experts. Someone just posted on it asking what the difference between Axios and async/ await is. The only reason I’m part of this group is so I can feel good about myself when I screw up while coding xP
-
There's a special place in hell for JS people using `.then()` and `.catch()` instead of simply `await func()`.
Why have 5 lines of code with an await, when instead you can have 5 nested `.then` callbacks.
And yes I know there are some cases where async/await isn't applicable, but that's rather rare25 -
Anyone ever seen the behavior with async methods and promises where at the end of what should finish the await in the calling code the function never progresses past the await even though it returned ?30
-
async void day()
{
wakeup();
CheckDevRant();
DoShit();
If(IsInMood)
GoOffice();
while(IsInMood)
{
Eat();
Game();
Code();
}
Eat();
Sleep()
await day();
}
Man I am having a bad day. Stack overflow -
It's nice that more and more languages are introducing async/await syntax, but by the example of Rust in particular I'm starting to wonder why we don't instead introduce this syntax for monads in general?
We could have a keyword (say, `bind`) which unwraps a value from any monad provided that the return value of the function is wrapped in the same monad. The ? operator does something a little similar, and I'll be intrigued whether it can actually be implemented for monads other than Result and Option once GATs are stabilized. In particular in the case of Rust, it would be possible to create a reference counting monad for heap-bound management of objects derived from references.9 -
Does anyone have a better way to implement throttle on value changes in c# ?
I'm using this right now and I find it a bit "too much lines"
@highlight
searchThrottle.Throttle(TimeSpan.FromMilliseconds(200))
.Select(e => ((string)e.Value)?.Trim())
.DistinctUntilChanged()
.Subscribe((x) =>
{
quisckSearch = x;
InvokeAsync(async () => await LoadFirstPage());
});3 -
Over the last week I've slowly grown to fucking hate IMAP and SMTP. You'd think after so many years we'd have come up with better servers to manage email but no we still rely on fucking decades old protocols that can't even batch requests.
To make things worse I need to attach to IMAP through node and that has been a nightmare. All the libraries suck ass and even the ones tailored towards Gmail don't work for Gmail because Google decided one day to fucking out the header at the bottom of some emails and split into mimeparts. Also why the fuck is fetching email asynchronous? There's no point at all since we requests are processed line by line in IMAP, and if the library actually supported sending asynchronous requests it wouldn't require a new object to be created for each request and allow only a single listener.
Also callbacks are antiquated for a while and it pisses me off that node hasn't updated their libraries i.e. TLS to support async/await. I've taken to "return await new Promise" where the resolve of the promise is passed as the callback, which let's me go from callback to promise to async/await. If anyone has any other ideas I'm all ears otherwise I might just rewrite their TLS library altogether...
And this is just IMAP. I wish browsers supported TLS sockets because I can already see a server struggling with several endpoints and users, it would be much easier to open a connection from the client since the relationship is essentially:
Client [N] --- [1] Server [1] --- [1] IMAP
And to make the legs of that N : N which would fix a lot of issues, I would have to open a new IMAP connection for every client, which is cool cause it could be serverless, but horrifying because that's so inefficient.
Honestly we need a new, unifying email protocol with modern paradigms...8 -
Modern Web Developer
(To the tune of "I Am the Very Model of a Modern Major-General" from Gilbert and Sullivan's "The Pirates of Penzance")
I am the very model of a modern web developer
I’m quite fluent with JavaScript; An HTML whisperer
My code is clean and elegant, I genuinely innovate
And even know my way around a Promise and async / await
I’m very well acquainted too with matters vector graphical
I understand why SVG coordinates seem magical
And even without Photoshop I elegantly can produce
A mockup or a logo in most any format that you choose
[Chorus]
A mockup or a logo in most any format that you choose
A mockup or a logo in most any format that you choose
A mockup or a logo in most any format that you choose
I'm quite adept at ES6 expressions like destructuring
I know the ins and outs of functional reactive programming
In short, in matters browser-based or Node.js if you prefer
I am the very model of a modern web developer
[Chorus]
He is the very model of a modern web developer
I know our mythic history, the humble start, the browser wars
I know why Douglas Crockford fought the battle over ES4
The World Wide Web Consortium and Ecma International
My knowledge of our legacy is truly supernatural
With LESS and SASS and CSS, designing for mobility
I’ll perfectly apply the right amount of specificity
From custom fonts and parallax to grid and flex and border-box
I know most every tip and trick both common and unorthodox
[Chorus]
He knows most every tip and trick both common and unorthodox
He knows most every tip and trick both common and unorthodox
He knows most every tip and trick both common and unorthodox
And when it comes to lazy loading, bundling up and splitting code
There’s nothing quite like Webpack, which of course is built on top of Node
Considering my resume, I’m certain that you will concur
I am the very model of a modern web developer
[Chorus]
He is the very model of a modern web developer
When new frameworks and libraries emerge I must be ravenous
And gobble up the hot new thing, my appetite is bottomless
React and Vue and Angular, Immutable, RxJS
The list will be outdated long before I'm finished singing this
My pull requests rely on multitudinous utilities
To help me lint and test and build, a deluge of analyses
And every single day there are a hundred thousand more to learn
The web is going through an irresponsible amount of churn
[Chorus]
The web is going through an irresponsible amount of churn
The web is going through an irresponsible amount of churn
The web is going through an irresponsible amount of churn
This pace is agonizing! Code from yesterday is obsolete!
The speed of innovation is enough to knock me off my feet!
It's happening too fast! I can’t keep up! I’m tired! It’s all a blur!
I am the very model of a modern web developer!
[Chorus]
He is the very model of a modern web developer!1 -
Can anyone point me to some example of a .net project that doesn't scale because not using async await for IO?
I'm not sure how to measure impact of not doing this...3 -
Originally I'm coming from Java , about 2 years ago, I switched Node with TypeScript and had a hard time getting accustomed to Promises. It was a big relief when I learned about async/await. Much cleaner code, no brainfuck anymore when thinking about how to handle stuff that requires multiple async values and so on.
Now I'm working on a clients project as a Java dev again. SOA, Spring Framework, Kafka and MongoDB, nothing too complicated... if they wouldn't use reactor to bring reactive functionalities to Java.
It feels like I'm back in Promise Hell...2 -
I'll need to do a survey on how different frontend frameworks support asynchrony, both in data and component loading.
I have a very powerful lazy loading primitive for React (https://github.com/lbfalvy/... ), but it's a bit broken so I'm rewriting it into a stateful TS class (because it would have to allocate a lot to be immutable and fast) and a React shim. I'm considering adapting it to other frameworks that struggle with code splitting or async data, or perhaps - like react - only ship a built-in solution that requires unrelated business logic to acknowledge the frontend framework.
Are you happy with the workflow of using asynchronously loaded data in your frontend framework of choice?1 -
Rant/question:
httpDoSmth1().subscribe(x =>
...then(y =>
httpDoSmth2(x).subscribe(z =>
//do smth with z
return z
)
)
)
Isn't this (not my code) callback hell all over again? The 2. http call expects results from the 1. http call. I feel like this could be solved cleaner using async await/switchMap/etc. ... but not like this.13 -
for some reason, the async/await C# keywords evoke the image of a child with ADHD running around in excitement shouting "async, async" and letting go of helium balloons in the air, while his father stands in a stiff brown suite and a mustach and every few seconds says calmly (but strictly): "await" .. just killing the excitement1
-
So I've been pondering for a while now: is async/await a load of bollocks, or am I just stupid?
I'm gradually coming to the conclusion that it's probably both.6 -
Hello chat, its been a long week with no progress, i have four problems right now.
1 node js repl cant recognize <> in js, and i cant find a fix for that anywhere on the internet, is there a way to convert html tags in js to smooth brackets code?
2 node js repl dosnt recognize codes like import react from react, and i have to do an async function load, and i dont know y or how to fix it.
3 i dont know how to write import exg.csv into an async function load, its usually something like “import react from react” to “async function load(){let react=await import (‘react’);}”, and i dont know how to do this.
4 i tried to install materials.ui using npm into a folder called materialsui in modules in node, it deleted all the other modules in module folder, installed, and then left the materialsui folder empty. I complained and i dont know how to get it to not do that.
5 how do i fix out of memory errors?8 -
I know I sound stupid but I need help, I create a repo on GitHub using gh-api ```js
export async function createARepo({name,description,token}) {
const headers = {
"Authorization": `token ${token}`,
"Accept": "application/vnd.github.v3+json",
}
const {data} = await axios(
{
method: "POST",
url: "https://api.github.com/user/repos",
data: {name,description,auto_init: true},
headers
}
)
return data
// console.log(res)
}```
when I run this code it only creates an empty project with a readme but I also want to create a file with a .html extension of the project can anybody help me with how I do this?7 -
I love and hate javascript. I set out to do a fully ajax/state driven form interface that operates with multiple interdependent data objects which all extend a base class.
React/Angular may have been a better call but I just didn't have time so I needed to rapid prototype in jquery /vanilla JS.
I'm in the midst of learning and refactoring all the ajax calls to promises and then to async/await, so it's a huge learning experience...
Meanwhile I've got to build objects to represent the data on the backend which is all legacy OScommerce/PHP
Hell of a ride. -
This is the story of how I spent 4h of my life trying to compile a simple node library written with es6 using babel 7.
My error was to use async/await. Previously babel wasn't that bad. A bit complicated and undocumented. But now is a pain in the ass as soon as you need something more than the prefix.
Don't use more time to make a compiler work than to write a library1