Finished this morning's Nim hacking and, well, it has async IO but it's rough as hell. Pretty much nothing is done for you, so it's a lot like JavaScript before async/await, but weirdly it has the await keyword. Some issues with this:
1. I'm not sure why the {.async.} pragma doesn't also setup that function to return Future[T]. It's kind of pointless if all that I get is the await keyword, and then every function I want to wait on has to be hand coded futures. Maybe the docs are just wrong?
2. I'm guessing this is more nanomsg's fault than Nim asyncdispatch, but the whole pollfd, addWrite/addRead system doesn't work on the send. I'll register addWrite, the pollfd will say it's ready, then the nanomsg send actually blocks, which...should be impossible.
3. Everyone wants to own the IO, but nobody gets it right. Nanomsg wants to be in charge, but gives you the pollfd through a complicated getsockopt, and then the pollfd doesn't work. Nim wants you to NOT use addWrite/addRead because of Windows, so...use only Nim? Nanomsg?
4. You'll notice I create an addRead and addWrite, but actually that's not correct. I'm only doing this because the backend will actually serialize these, but with this setup I could read and write totally out of order since they just go when the event happens. Why did I do it?
5. Again, writing these Futures is brutal. If want to have a send then a recv (which is probably 95% of all IO) I have to write the sendCommand to run, then *it* does addRead after the send to chain the future. Now we're back to callback hell from JavaScript.
6. My expectation in an Async IO system is I say "this thing is async IO", then I just do read/write like normal and it figures it out for me. No futures, no callbacks, no await, just automatic IO concurrency. You could probably build on asyncdispatch to do it.
7. Finally, Nanomsg has a serious issue if the pollfd it gives me doesn't actually work. This was the exact same problem with ZeroMQ, where they wanted to be the IO KING and all the code was written as if I'm not a professional who knows how to do my IO better.
• • •
Missing some Tweet in this thread? You can try to
force a refresh
I have a lot of people who recently learned to code but then ask me what they could make. I'm a big proponent of copying everything you like (and dislike too) just to learn how it's done, but I think that's too big of a field for some folks to tackle. Here's some ideas:
You should get a little notebook and start writing down random ideas that pop in your head, even if they're stupid. Try to write more than one sentence about the idea so you know what it is later. Drawing a screen or two helps also.
You could also use Zettlr or RoamResearch.
Next, you need to write a short essay about one of your ideas, explaining the idea and possibly getting into a story about who is using it and how they use it. This will help you "export" the idea into a written form and organize your thoughts.
I'm toying with the idea of getting the PS 5 or Xbox, and I absolutely hate the false scarcity they pull. I mean, I'd pull a J. Wellington Wimpy with "I will gladly pay you Tuesday for a game console next month," but these people just don't know how to write a ordering website.
I'm too old to run around hunting down deals and trying to do Black Friday BS. I don't even care if it arrives next month. Just let me put in an order, send it when it's ready, but *don't charge me until it's sent*. At this point the one I pick is whatever one is available.
I also find it bizarre they can't calculate demand. You've sold like 5 versions of this thing and have the most advanced computerized logistics systems in the world and you're like, "It'll be ready on Black Friday...MAAAAYYBBEEE. Better beat up a grandma for it! MWHAHAHAHA."
Hit a bug in @WindboundGame that is either the worst possible thing they could have, or a possible new way to make the game more challenging. If you enable the blessing Arms of Imakl suddenly I losing things at random, even in held items, and usually after restoring from a save.
The irony of it is this one blessing in the game is *supposed* to help you keep a couple extra items if you die, and give you a couple slots. I tested that it's randomly losing items by actually crashing my boat 20 times and lost nothing. Also dived in the water and nothing.
But, save, and reload, and yep, lost a couple things. I think what's going on is the blessing adds two inventory slots, and the devs added it late, so they get the count wrong on reload and drop two items.
From what I can tell nanomsg has flags for things like "DONT_WAIT", but they seem to be pointless. It doesn't block anyway when you set the flag to 0. I couldn't figure out why it just ran in an insane loop and well, that's all it can do.
One of the things that ZeroMQ did which made it *very fast* is it did a kind of run length encoding of messages. Rather than send 1 million messages all the same, it would just say "that one, 1 million times". Browsing through nanomsg I think that's gone, but it was THE feature
Browsing through the QUIC and HTTP/2 standards and I'm kind of wondering why all those jackasses who told me I was wrong for saying HTTP/1.1 was garbage for being a text protocol didn't freak out at this heresy. You wouldn't believe the illogical backflips the IETF and W3C did.
For a bit of context, I wrote a web server that utilized a precise parser for the HTTP/1.1 protocol, and rejected any messages that didn't parse correctly. Turned out this ended up blocking about 80% of hacks at the time while allowing normal traffic through without problems.
When I did this a whole ton of HTTP/1.1 IETF douchebags made bizarre claims that this would destroy the web, that I had to accept everything or else, and that the parse must be hand written.
It occurred to me that the programmers who work at Amazon must be terrible programmers. They're getting paid millions a year for a trillion dollar company and they run around grabbing tiny open source projects to resell...but aren't skilled enough to just make their own?
How is it possible 3 top paid programmers at Amazon can't sit down and crank out a copy in a week. In fact, I'd say if you can't crank out a copy of a small competitor in a week you're not nearly as good as you claim.
They do eventually write their own, but only after the projects decide they've had enough giving Amazon free tech support: