Data Types - Part 3 of Idiomatic Rust in Simple Steps

Поділитися
Вставка
  • Опубліковано 16 вер 2024

КОМЕНТАРІ • 8

  • @FiosQuest
    @FiosQuest  5 місяців тому

    Erratum (and other fun stuff):
    =======================
    I've got some small silly ones today, but if you spot anything I've missed, please let me know so I can add them and we can help make this better! 💖
    ASCII
    ---------
    The character encoding I mention in the Binary primer is called ASCII but there are 128 characters, not 127 (I forgot zero 🤦🏻‍♂). There are also control characters in ASCII which are characters that tell the computer to do something but are otherwise effectively invisible.
    Nybble
    -----------
    Discovered this gem while editing. 4 bits (half a byte) is sometimes referred to as a nybble. That makes each hexadecimal digit a nybble. Not useful, just cute. 🥰
    Negative Zero
    ----------------------
    Another weird one I found while editing, there's another numbering scheme for integers called One's Complement. It works a bit differently, but gives us numbers -127 to +127... and both +0 and -0. Thank goodness we don't use that, having to deal with both positive and negative numbers would have been rough right float? ... Right float?
    (Float has positive and negative zero, positive and negative infinity and multiple values for "not a number").
    Tuple
    ---------
    Oh the irony! I made a joke about not wanting to change my pronunciation on char, but a lot of people say "two-pl". This is because historically, it specifically represented two values _but_ in this case the correct pronunciation _is_ tuh-pl (but you will definitely hear it both ways and that's fine).
    The Unit Type
    ----------------------
    I never closed the loop on this one 🤦🏻‍♂. I mentioned we often use the unit type () in Generics but never gave an example. Imagine a function which perhaps sends a message but doesn't get anything in return. We might want an Error type to explain what went wrong, but we'd use the unit type for the success value as the success itself is all we care about, eg: Result
    Memory Usage
    ------------------------
    I feel like I made a bit of a fuss about how much memory various Types take up, but, you don't need to worry all that much.
    i64 Max
    -------------
    As spotted by @crazyingenieur3277, the max value for i64 is "9,223,372,036,854,775,807" not "127"

  • @riigel
    @riigel 5 місяців тому

    More! really great content! thanks for this!

    • @FiosQuest
      @FiosQuest  5 місяців тому

      Thank you so much. 😊

  • @xav_624
    @xav_624 5 місяців тому

    Your binary explanation is 👌👌😍

    • @FiosQuest
      @FiosQuest  5 місяців тому

      Thanks! I was really worried actually, the entire point of this series is to help get rid of the "Rust is hard" stigma and I've jumped straight to memory and binary, how many programming tutorials start there?! 😊
      However, I think it's important to set up that foundation, it's going to make everything else much easier, and just because many tutorials don't start with low level foundational stuff doesn't mean its necessarily hard or uninteresting. It's not _easy_, sure, but I think people will get it. 🤞🏻 And I'll do my best to answer questions where I might have missed something or where I've not connected in the right way.

    • @xav_624
      @xav_624 5 місяців тому

      @@FiosQuest Definitly! I'm a frontend guy who wants to understand more and expend my field of action, and believe it or not, there's not much quality content on those fundamentals. I find it hard to find what I'm looking for. But I loved this. I'm looking forward for the following parts. Take care ✌

  • @crazyingenieur3277
    @crazyingenieur3277 4 місяці тому

    I am pretty sure the max value of i64 is not 127.

    • @FiosQuest
      @FiosQuest  4 місяці тому

      Dang, good spot! 😅 Not a lot I can do about the video, but I've corrected the IRISS book, and will add it to the erratum. Thank you!