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

help-circle
  • Recently I had to do an update to the underlying environment a codebase ran on. This was a somewhat involved upgrade and took a longer period of time than most of our work usually does. I did it in a separate worktree, so I didn’t have to constantly rejuggle the installed dependencies in the project, and could work on two features relatively concurrently

    It also provides some utility for comparing the two versions. Nothing you couldn’t do other ways, but still useful






  • An ad hoc sorting system for a grid of tiles on an enterprise app

    Instead of sorting across row wise, it sorted columnar. So it was

    A E I M
    B F J N
    C G K O
    D H L P
    

    Instead of

    A B C D
    E F G H
    I J K L
    M N O P
    

    This was a requirement from the CEO. Since we used this project (dogfooding) we stuck a secret search box/command palette in, which you could hit . and then type the name of the thing you wanted and click it





  • In theory yes, but it becomes a problem of ergonomics. The transpiled library feels like a transpiled library, it doesn’t match the conventions of Nim/Zig. The best ports/wrappers/whatever typically use the C lib for all the heavy lifting and unique things, and build their own interface, that matches conventions of the calling language


  • Paradox@lemdro.idtoProgramming@programming.devLet's talk about Zig
    link
    fedilink
    English
    arrow-up
    5
    arrow-down
    1
    ·
    10 months ago

    Its a neat language, very simple. Has a somewhat simple approach to codegen at compile time, which is both a boon and a curse; you can do a lot with it, and not get too deep into footgun territory, but once you hit the limits of what you can do, you’re pretty much stuck there.

    The syntax and other features are very nice, and it makes rather small binaries. I’d say its comparable to Nim in this area.

    Sadly, it also suffers the same problems Nim suffers: dearth of libraries.






  • Well, one major difference between nim and zig is that nim has codegen features built in, and the ergonomics are so simple around them you’ll wind up using them without knowing.

    Nim, if you just start calling functions in your code, will evaluate them at compile time. This means you can use loops and other constructs to generate bits of code. This is similar to how it works in Ruby and Elixir (and python too IIRC).

    So you can do this contrived example:

    for i in [a, b, c]:
      proc i =
        echo "Generated proc"
    

    That code probably wont work, but you can see the utility on being able to generate stuff inside your source code.

    Zig explicitly has chosen to not have codegen features. The reasoning is that it keeps the language simpler, and is inline with Zigs efforts to stay away from macros and templates. The closest you can get is the comptime keyword, which evaluates it’s right at compile, but it’s very limited