Writing a program takes forever he said. Zig and Rust anyone?

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

КОМЕНТАРІ • 38

  • @stretch8390
    @stretch8390 7 місяців тому +3

    As someone currently attempting to learn Zig (first low level language), content like this where you code and respond to compiler error messages is so helpful!

    • @CallousCoder
      @CallousCoder  7 місяців тому

      Thank you, I am glad it's helpful for you!

  • @megetmorsomt
    @megetmorsomt 6 місяців тому +2

    In Nim:
    import strutils
    for line in lines "temps.txt":
    try:
    echo(
    if line[^1] == 'F':
    $((line[0..line.high-2].parseFloat-32)*5.0/9.0).formatFloat(ffDecimal,1)&" F"
    else: line
    )
    except:discard

    • @CallousCoder
      @CallousCoder  6 місяців тому +1

      In vi one line ( the next video 🤣)

    • @megetmorsomt
      @megetmorsomt 6 місяців тому

      @@CallousCoder Can't wait to see it 🙂

    • @CallousCoder
      @CallousCoder  6 місяців тому

      @@megetmorsomt it’s online 😉

    • @baxiry.
      @baxiry. 5 місяців тому +1

      @@CallousCoder 🤣🤣

  • @ZombieJig
    @ZombieJig 7 місяців тому +3

    Or you could write it in 5 minutes in Python.

    • @CallousCoder
      @CallousCoder  7 місяців тому +2

      Or do it in vim in less than a minute. The next video 😉
      But I would probably have don’t if in Python. And I loathe Python ☺️

  • @steveoc64
    @steveoc64 7 місяців тому +1

    But awk is written in C, which is not memory safe … so it could randomly segfault at any moment, wipe out your hard drive, knock over your chair, and set fire to the bookshelf all at the same time.
    Scary AF !

    • @CallousCoder
      @CallousCoder  7 місяців тому

      That's not true a memory fault will never lead to a harddrive wipe and I mean after 40 years it is robust. Besides it's rather trivial to do memory safe because it's a stram processor.

    • @steveoc64
      @steveoc64 7 місяців тому +1

      @@CallousCoder sorry mate .. was having an oblique dig at the more fearful types out there who say you can only use rust, because anything else might randomly segfault:)

    • @CallousCoder
      @CallousCoder  7 місяців тому +1

      @@steveoc64 😀😁🤣yeah the Rust clan is almost an organized religion 😅
      It’s ironic isn’t it… they do get into cars, trains, aeroplanes and they are full of C code 😀

  • @androth1502
    @androth1502 7 місяців тому +1

    canada can't make up mind either. we have a mind boggling mix of both metric and US-imperial systems.

    • @CallousCoder
      @CallousCoder  7 місяців тому

      Oh really? I haven’t noticed it when I was there.
      The only think I noticed was the idiotic low speed limit of 110K through the mind numbingly empty prairies of Saskatchewan and having the funds to have a copper posting every 10KM to enforce that limit 🤣

    • @androth1502
      @androth1502 7 місяців тому +1

      @@CallousCoder it's mostly by the people and more predominant the closer you get to the border.
      when talking about height, inobody says centimeters, it's always feet and inches.
      weight, we use lbs. nobody knows how many kg they weigh or lift.
      temperature? it's 50/50 between Celsius and Fahrenheit .
      food recipes? all imperial.

  • @judsenhembree7697
    @judsenhembree7697 7 місяців тому +3

    Why force vscode into your vids? Just use vim. Lol.
    Sounds like you use vim usually.

    • @judsenhembree7697
      @judsenhembree7697 7 місяців тому +1

      Good vid btw

    • @CallousCoder
      @CallousCoder  7 місяців тому

      Well font size in kitty is not dynamic and the font is otherwise too small.
      And I also need to setup neovim on this new system still :D I should also lookup the keyboard shortcuts in VSCode as most customers use that crap ;)

    • @CallousCoder
      @CallousCoder  7 місяців тому

      @@judsenhembree7697Thanks for watching and the compliment. Happy you like it. It seems many people like the smaller easy to do program videos.

    • @judsenhembree7697
      @judsenhembree7697 7 місяців тому +1

      @@CallousCoder I'm actually more interested in embedded zig. I'm trying to do an arduino project with led lights.
      Zig on an arduino uno would be my video request.
      I got the test light blinking yesterday. Need to figure out the led part now.
      Might try to use predefined c funcs. From arduino libs.

    • @CallousCoder
      @CallousCoder  7 місяців тому

      @@judsenhembree7697 I actually have 4 videos on zig for pi pico on here making the Simon game. The ATMel is minimally supported by the embedded zig and I read they canceled further development. But I assume digital ports will work, it’s the easiest to do, even without a HAL (hardware abstraction layer) it is pretty straightforward.
      I understand why they aren’t too thrilled to continue on atmel it being an 8 bit micro controller that are more expensive than 32 bit arm cortex.

  • @ViaConDias
    @ViaConDias 7 місяців тому +2

    And now just do it in Vim and be done in 2 minutes ;-)

    • @CallousCoder
      @CallousCoder  7 місяців тому +2

      Well my typing disability is also pervasive in vim but I would be a bit faster for sure :D

    • @ViaConDias
      @ViaConDias 7 місяців тому +1

      @@CallousCoder Having MS and not being able to feel my fingertips I can relate to typing mostly random chars all-day 🙂
      But, I didn't mean 'write the program in Vim' I meant 'do it in Vim'. Pattern match, macro, etc.

    • @CallousCoder
      @CallousCoder  7 місяців тому +1

      @@ViaConDias oh man MS! I’m sorry. Must be so frustrating when your body doesn’t want to keep up anymore. I’ve had a neck hernia 15 years ago and I lost control over my right arm for sometime and my thumb still feels a bit numb. I could even unscrew something for a few weeks or do card magic or play guitar. I was so frustrated. Luckily that all came back in my case. But I was seriously worried so I can only imagine what you go through. Always wondering/worrying if it progresses. Brrrr I really feel for you.
      Hope it just stabilizes.
      And I think you should be able to do it all in vim. I actually never calculated something in vim but you can call bc of course. Hmmmm I feel a challenge 🤣

    • @ViaConDias
      @ViaConDias 7 місяців тому +1

      @@CallousCoder Sorry to hear that. I was paralyzed in the right side of my body for 3 years and the doctors told me I had 1 - 2 years left. That was 16 years ago and today you wouldn't be able to see that I am sick. I am close to the best shape of my life and I have a great life. Took me 10 years in the gym but hey, life is life, and if your mother ever told you it was going to be easy she was lying. If you keep pushing forward every day then no matter the outcome, at least you know you did what you could and you can't really ask more from yourself.
      I don't know what OS you are on but in Linux you would have 'calc' available to you. But a simple script that takes the number as an input and only does the actual calculations would do it too. Python or Zig, doesn't matter much.
      Hope you take it on and post a follow-up video.

    • @ViaConDias
      @ViaConDias 7 місяців тому +1

      @@CallousCoder And when I wrote 2 minutes I wasn't joking, that is all it will take in Vim (when you know how to do it, of course)

  • @timibolu
    @timibolu 7 місяців тому +1

    the guy's not serious. what does he mean by it will take forever?

    • @CallousCoder
      @CallousCoder  7 місяців тому +2

      He means it hyperbolically. It takes longer to write a program in a general purpose language for sure -- especially when you use awk frequently. In my case I would probably spend as much time getting it done in awk :D His video is btw really good.

    • @timibolu
      @timibolu 7 місяців тому +1

      Oh I didn't get that. Nice video by the way@@CallousCoder

    • @CallousCoder
      @CallousCoder  7 місяців тому

      @@timibolu thanks glad you enjoyed it.

  • @omaralraisi1143
    @omaralraisi1143 7 місяців тому +1

    Still easier to write and use than awk

    • @CallousCoder
      @CallousCoder  7 місяців тому +1

      I tend to think so too 😜