this post was submitted on 29 Sep 2024
16 points (94.4% liked)

Rust

5807 readers
78 users here now

Welcome to the Rust community! This is a place to discuss about the Rust programming language.

Wormhole

!performance@programming.dev

Credits

  • The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)

founded 1 year ago
MODERATORS
 

Hi rustaceans! What are you working on this week? Did you discover something new, you want to share?

top 11 comments
sorted by: hot top controversial new old
[–] patrick@lemmy.bestiver.se 1 points 2 hours ago

I've been slowly building a text based MMO game that I will probably continue working on this week: galactic-war

It's based on Inselkampf, a very slow-paced game that I played years ago and wanted to play again. Inselkampf just started a new World this weekend, which it does every ~6 months, so I will probably end up working on my virtual clone of it this week while I'm thinking about it.

If you wanted to play too now would be a very good time to start. The userbase has continued dropping over the years it seems, with only a few dozen to a couple hundred players.

I also want to get releases and announcement posts out for a couple of my Matrix bot projects this week, pokem and chaz, but that's been on the backlog for a couple weeks already

[–] soulsource@discuss.tchncs.de 2 points 10 hours ago

I haven't done much Rust coding this year yet, mainly because I am trying to learn Lean4 and spent the last couple of months writing a (partially) formally validated (but not very fast) Binary Heap in Lean4.

However, a few days ago I had an inspiration at night, that brought me back to my Rust spare time project: The visual novel engine I had started last year.

For now I only did a relatively small change, but it's one that will save me a lot of time (and nerves) later on. I am using a Free Monad based embedded Domain Specific Language for writing the game logic. The change now was to wrap that Free Monad in a State Monad Transformer, which I use to store the game state in.

This idea seems to be working surprisingly well, and that has given me enough motivation to return to this project and to keep developing it further for now.


Long and boring explanation with way too much detail:

Sorry for going on a tangent, but there is a Rust-specific detail that makes this cool beyond the usual advantages of using a State Monad Transformer, and I cannot stop myself from sharing.

For composing a large Free Monad, do-notation is more or less a must-have. However, do-notation in Rust only works well with types that implement Copy. If you want to use any other type in do-notation, you can only access variables of it in the following two lines. An attempt to access the data later will lead to an ownership problem (explained here). I have tried to overcome this by adding additional syntax to do-notation, but that is a crutch at best.

So, this is where the State Monad Transformer comes in. It side-steps this problem by moving the state out of the do-notation block into the Free Monad's Pure-nodes. That way it is readily available via the State Monad Transformer's get()/put() functions, and the "use within two lines" limitation is not a big issue any more, as one can always get the value on one line, do something with it in the next line, and write the result back on the second line.

[–] AsudoxDev@programming.dev 2 points 12 hours ago* (last edited 12 hours ago)

Working on a lemmy moderation bot that receives webhooks instead of making API calls to retrieve certain stuff.

[–] webbureaucrat@programming.dev 6 points 17 hours ago (2 children)

I'm working on a fault-tolerant JSON5 parsing library in the service of a JSON5-to-JSON and JSON5-to-YAML transpiler.

My goal is to never write any more YAML ever again.

[–] 8Bitz0@discuss.tchncs.de 1 points 5 hours ago (1 children)

What did YAML ever do to you?

[–] webbureaucrat@programming.dev 1 points 4 hours ago

I am a YAML hater. The biggest thing about YAML that keeps biting me recently is this:

script:
    - echo "a key: a value"

throws parse errors because of the colon, even though it is inside a quoted string.

But there are lots of reasons to hate YAML.

Honestly, an underrated one to me is I just hate significant whitespace. I don't want to use any language that supports it.

[–] secana@programming.dev 4 points 16 hours ago

An honorable goal 😀

[–] myopic_menace@reddthat.com 1 points 12 hours ago (1 children)

Trying to build a Pomodoro timer applet in libcosmic.

[–] patrick@lemmy.bestiver.se 1 points 2 hours ago

That's interesting, I heard of Cosmic recently but I haven't had a chance to try it yet. I guess you're liking it if you're already building apps on it?

[–] secana@programming.dev 3 points 16 hours ago (1 children)

Just released Kellnr (https://kellnr.io) 5.2.6 with some bug fixes. I really wish I had more time for new features but at the moment my spare time is rare. If you want to host your own crates on your own infrastructure, check it out.

[–] 8Bitz0@discuss.tchncs.de 1 points 5 hours ago

That’s neat. I’ll definitely be taking a look at that.