• 0 Posts
  • 15 Comments
Joined 1 year ago
cake
Cake day: June 10th, 2023

help-circle


  • pimeys@lemmy.nauk.iotoProgrammer Humor@lemmy.mlHexed by async
    link
    fedilink
    arrow-up
    45
    arrow-down
    1
    ·
    1 month ago

    So basically your typical network protocol is something that converts an async stream of bytes into things like Postgres Row objects. What you do then is you write a synchronous library that does the byte conversion, then you write an asynchronous library that talks with the database with async functions, but most of the business logic is sync for converting the data coming from the async pipe.

    Now, this can also be done in a higher level application. You do a server that is by nature async in 2024. Write the server part in async, and implement a sync set of mapping functions which take a request coming in and returns a response. This can be sync. If you need a database, this sync set of functions maps a request to a database query, and your async code can then call the database with the query. Another set of sync functions maps the database result into http response. No need to color everything async.

    The good part with this approach is that if you want to make a completely sync version of this library or application, you just rewrite the async IO parts and can reuse all the protocol business logic. And you can provide sync and async versions of your library too!







  • If you want something that is quite a nice editor too but doesn’t require hundreds of lines of configuration, try helix. It also has nice help menus so it’s fast to learn. I’ve used vim since the 90’s and Emacs for many years, but nowadays I kinda just like hx how it just works with zero configuration for any programming language I need to work with.



  • I’m a vim and emacs user for some decades already. I had this urge one day to try and work with helix. It kind of misses some things such as file manager or editorconfig support. Nine months later I’m still using helix. It still misses these things, but I really started to like how I don’t need any plugins to work with it and I need about five lines of configuration to have a usable editor. Probably going to continue using it.

    And it is written in Rust, which is my main language and I can just jump in to the editor source and fix things if needed.

    I miss magit and org from emacs a lot though. Every time I need to write an article, I do it in emacs.