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

help-circle

  • IMO the best way to start in a new language is to rewrite some of your previous projects in that language.

    I generally start out by rewriting a couple simple 1-3 function console apps, basic leet code stuff like; palindrome, fizzbuzz, reverse an array in place, etc, and some simple unit tests for them. Then I go ahead and rewrite some of my previous projects or uni assignments in that language.

    At that point I generally have a good understanding of basics and have an idea of how to approach a new project. When I got to this point in rust I then started on threading, async, why it’s easy to return a String and an ordeal to return &str, etc.


  • The performance is just a “nice to have”.

    Python package management, especially at scale is infuriating. At work we use python microservices in docker containers and it infuriates me trying to update the one our team is responsible for.

    I always like to rant that python 3rd party package management tools are a mistake. We should’ve gone for an “as simple as possible” setup instead of all this.

    So I’m sceptical of UV on principle since it’s yet another 3rd party package manager but if it can do all of this and not be a nightmare I’ll be ok with it.




  • The AOSP is a huge success and phones are really only the tip of the iceberg, android runs everywhere and is basically responsible for the mainstream adoption of “smart” devices.

    It’s a small OS that runs on basically anything and you can stick it on most computers regardless of how strange the hardware setup is.

    Is it perfect? No, as a project android is basically maintained by Google alone and Google obviously doesn’t think it’s perfect, or fuschia wouldn’t exist.





  • To do quick and simple explanations:

    var test int = 0
    

    assign an int, var = let in rust land

    := 
    

    This is basically an inferred assignment e.g.

    a := "hello world"
    

    The compiler will know this is a string without me explicitly saying

    func (u User) hi() {}
    

    To return to rust land this is a function that implements User. In OOP land we would say that this function belongs to the user class. In Go, just like in rust we don’t say if a function returns void so this function is for User objects and doesn’t return anything:

    func (u User) hi(s string) string {}
    

    If it took in a string and returned a string it would look like this.

    map[string] int {}
    

    I will give you that this syntax is a bit odd but this is just a hashmap/dictionary where the key is a string and the value is an int






  • It looks like it’s 3x faster than the previous cpython wasm compilation. Recall that most of the performance improvements in python have been done in the last ~2 releases.

    My distro is debian based so it’s still on 3.10 which I would guess this new wasm implementation is much closer to in performance.

    Compiling to wasm also means that you can distribute a binary rather than needing people to have python installed.






  • I remember watching a video of someone writing C code and making the same thing in unsafe rust. While the C code worked just fine the rust code had UB in it and was compiled to a different set of instructions.

    Unsafe rust expects you to uphold the same guarantees that normal rust does and so the compiler will make all the same optimisations it would if the code wasn’t unsafe and this caused UB in the example rust code when optimised for performance. It worked just fine on the debug build, but that’s UB for you.