Hello,

This is my first post to this Rust community and I am happy to introduce myself and discuss what I love about this language, but first a little about myself.

I’m Alice, Fluffy to most, and she/her are my pronouns. I’m from the UK. I got a little boy who love like crazy. I’m Autistic, suffer from cPTSD and I also 🩷 Rust!!

Rust I feel appeals to Autistic people because of it’s focus on accuracy and correctness. It’s a common feeling people have about the language. But as the type of person I am I love it.

I began learning it in 2023, before this I was using C++. Rust showed me the importance of error’s as values and helped improve the quality of my code.

Currently I’m writing a game-engine as a hobby. The game-engine is a work in progress (WIP) and I have only just begun it’s development. Since the game-engine will natively support various platforms. To ensure consistency I’m writing all the platform specific code manually and building my own custom standard library for my engine, loosely based on the actual Rust standard library.

Right now I have the code in place to create/remove directories and to create, delete, write, read and set file pointer location. Convert UTF8 to UTF16 and output to the console in Unicode (Windows C API uses UTF16) and heap functions to get the process heap and create and delete memory dynamically.

Next will be the ‘config.json’ for which Serde will be used. Then the logger, and so on.

So it is a WIP but it’s fun and given my conditions allows me to do what I love, writing Rust code.

Thanks for reading!!

Alice 🏳️‍⚧️

  • Ephera@lemmy.ml
    link
    fedilink
    English
    arrow-up
    1
    ·
    10 hours ago

    Really? I feel the opposite. I’d much rather have indentation enforced by the language than merely convention.

    Well, I don’t have a problem with incorrect indentation. As in, the people I work with indent their code correctly, so I don’t need enforcement. If you do need enforcement, you can also throw an autoformatter onto a braced language and it’ll be able figure it out.

    But yeah, to me it’s rather that the additional visual cue of indentation + braces helps me a lot. I check the scope of things quite often. If I need to guestimate whether one line has a different indentation than another, that just takes longer and I’ll misread it more often.

    But well, in that vein, I also like braces, because I like to use explicit scopes. If I construct a more complex variable which needs intermediate variables, then I’ll isolate the construction process into a separate scope, so that folks reading the code know for certain that these variables will not be used further down. It’s kind of like the isolation of a function, except you don’t explicitly pass things in.

    The quotes thing is acceptable IMO since it allows for flexibility in keys (e.g. you can have a URL as a key)

    For serializing data, absolutely. But no one in their right mind would use a URL for the name of a configuration field. 🙃

    And I can kind of understand them disallowing comments, ever since I saw an XML file which had data encoded into comments. Not any XML file, but one of the most important XML formats in a larger company. Which, I guess, is why they were scared of adding more nodes, in case any applications wouldn’t be able to handle that.
    But yeah, that is again assuming JSON to be used for serializing data, not for configuration. The two use-case are just kind of at odds.

    I don’t think it has anything to do with error messages though, plenty of languages do that well without it.

    Well, I don’t think it’s impossible to solve it without semicolons, but I do think that it makes it harder. And if it’s harder, it will be solved later, which can result in a culture of people not caring for readable errors. And that is then really hard to undo.

    • sugar_in_your_tea@sh.itjust.works
      link
      fedilink
      arrow-up
      1
      ·
      10 hours ago

      autoformatter

      My point was hypothetical. The goal is consistent formatting. Python enforces that at a language level, which eliminates a lot of issues from C style languages, like Apple’s infamous goto fail, which was a block scope issue:

      if ((err = SSLHashSHA1.update(&hashCtx, &signedParams)) != 0)
          goto fail;
          goto fail;
      

      In Python, such ambiguity is impossible.

      I like to use explicit scopes

      As do I, largely because I can do things like if (condition) { fn(); } else { fn2(); } in one line without using a ternary. I especially like Rust’s blocks as expressions (let x = if condition { y } else { z }; ), but for other reasons. I hate ternaries, so maybe that’s why.

      But I find Python highly readable, which is why I was surprised.

      folks reading the code know for certain that these variables will not be used further down

      That’s a separate issue though. In Python, you don’t have block scope, but that’s not a syntax limitation, but a language choice.

      For serializing data, absolutely. But no one in their right mind would use a URL for the name of a configuration field.

      Which is why you use a data format for data and a config format for configs. JSON is fine for data, and not fine for configs.

      JSON doesn’t have comments because it’s a data format. But since it’s also used for configs (which it shouldn’t), it should support comments and trailing commas at minimum.

      Just use a config format for config, like TOML.