HNHacker News
TopNewBestAskShowJobs

archargelod

1,096 karma · joined May 28, 2023

submissionscomments
archargelod··on Go-legacy-winxp: Compile Golang 1.24 code for Windows XP
Coincidentally, just a few days ago, I tried to run Nim[0] on Windows XP as an experiment.

And to my surprise, the latest 32-bit release of Nim simply works out the box. But Nim compiles to C, so I also needed C compiler. Many versions of mingw I could find online - they all failed to launch.

After some time I managed to find very old Mingw (gcc 4.7.1) that have finally worked [1].

[0] - https://nim-lang.org/

[1] - https://ibb.co/TBdvZPVt

archargelod··on Ask HN: What did you find out or explore today?
It's usually code compiled with Mingw that gets AV false-positives in Nim. But, indeed, you can use clang or zigcc compilers instead.

Nim has good support for Clang, so it works by just switching a single flag: `nim c --cc:clang main.nim`

For zigcc - there is a wrapper package you can install with nimble: `nimble install zigcc`

Then you can use it with: `nim c --cc:clang --clang.exe=zigcc --linker.exe=zigcc main.nim`

Of course, you can save the flags in configuration files. You can look at my setup for inspiration [0].

[0] - https://codeberg.org/janAkali/grabnim/src/branch/master/conf...

archargelod··on Zen-C: Write like a high-level language, run like C
From what I see, Zen-C aims to be "C with super-powers". It still uses C pointers for arrays and strings. It transpiles to single human-readable C file without symbol mangling. No safety. Not portable (yet?).

Nim is a full, independent modern language that uses C as one of its backends. It has its own runtime, optional GC, Unicode strings, bounds checking, and a huge stdlib. You write high-level Nim code and it spits out optimized C you usually don't touch.

Here’s a little comparison I put together from what I can find in the readme and code:

    Comparison          ZenC           Nim
    
    written in          C              Self-Hosted
    targets             C              C, C++, ObjC, JS, LLVM (via nlvm), Native (in-progress)
    platforms           POSIX          Linux, Windows, MacOS, POSIX, baremetal
    mm strategy         manual/RAII    ARC, ORC(ARC with cycle collector), multiple gc, manual
    generated code      human-readable optimized
    mangling            no             yes
    
    stdlib              bare           extensive/batteries-included
    
    compile-time code   yes            yes
    macros              comptime?      AST manipulation
    
    arrays              C arrays       type and size is retained at all times
    strings             C strings      have capacity and length, support Unicode
    bounds-checking     no             yes (optional)
archargelod··on I dumped Windows 11 for Linux, and you should too
Seconding this. I was impressed by Void linux stability and speed: xbps (with xtools) might be the fastest and most powerful package manager I've *ever* used.

Sure, Void doesn't have the endless options of Arch+AUR for packages, but it had everything I needed. Even the well-maintained, latest versions of less common software, like Nim compiler.

The author might also missed that Void has a non-free repository, that you have to install for stuff like proprietary drivers, DRM and Steam.

archargelod··on Oh My Zsh adds bloat
Better way to benchmark zsh startup time is with zprof. Add this to your ~/.zshrc:

    zmodload zsh/zprof
    .. rest of your zsh config ..
    zprof
And then restart terminal.
archargelod··on Oh My Zsh adds bloat
I was annoyed by this enough that I ended up cloning the OMZ repository locally, and stripping out all the modules I don’t use. And now I just have it as part of my dotfiles[1].

It's just a handful of files and I manually source them in my zshrc[2]:

    source $ZSH/lib/async_prompt.zsh
    source $ZSH/lib/key-bindings.zsh
    source $ZSH/lib/completion.zsh
    source $ZSH/lib/history.zsh
    source $ZSH/lib/git.zsh
    source $ZSH/lib/theme-and-appearance.zsh
It's essentially the same as omz setup I was using before, but loads in just ~25ms (Note: it's on a hard drive, with ddr3 ram and 18ms out of that is spent by compinit)

It also fixed another issue I had with Oh-My-Zsh: whenever they (very rarely) tweak their default config - it breaks my muscle memory.

[1] https://codeberg.org/janAkali/dotfiles/src/branch/main/confi...

[2] https://codeberg.org/janAkali/dotfiles/src/branch/main/zshrc

archargelod··on Go away Python
You can replace Python with Nim. It checks literally all your marks (expressive, fast, compiled, strong-typing). It's as concise as Python, and IMO, Nim syntax is even more flexible.

https://nim-lang.org

archargelod··on Programming language speed comparison using Leibniz formula for π
> Nim "cheats" in a similar way C and C++ submissions do: -fno-signed-zeros -fno-trapping-math

I don't see these flags in Nim compilation config. The only extra option used is "-march=native"[0].

[0] https://github.com/niklas-heer/speed-comparison/blob/9681e8e...

archargelod··on Ask HN: What Are You Working On? (December 2025)
Skyrim mod manager for the Nintendo Switch version of the game.

It’s mainly for personal use because converting, renaming, and packing mods in bulk can be very tedious. Especially if you're always changing your mod list (which is a given).

However, once I make it more user-friendly and add a proper GUI, I’ll likely release it to the public.

archargelod··on Using Python for Scripting
If a script is simple - I use posix sh + awk, sed, etc.

But if a script I write needs to use arrays, sets, hashtable or processes many files - I use Nim[0]. It's a compiled systems-programming language that feels like a scripting language:

- Nim is easy to write and reads almost like a pseudocode.

- Nim is very portable language, runs almost anywhere C can run (both compiler and programs).

- `nim r script.nim` to compile and run (cached on subsequent runs) or use a shebang `#!/bin/env -S nim r`

- Nim programs are fast to compile (use debug mode and tcc compiler for almost instant compile times)

- Nim scripts run very fast <10ms (something that was very annoying to me with bash and Python)

- good chances you don't need external dependencies, because stdlib is batteries included and full of goodies.

- if you need external deps - just statically link them and distribute a cross-compiled binary (use zigcc[1] for easy Nim cross-compilation).

[0] - https://nim-lang.org

[1] - https://github.com/enthus1ast/zigcc

archargelod··on When would you ever want bubblesort? (2023)
Terminating condition in Bubble sort is "did we swap any values during this loop"? Yes -> continue, No -> list is already sorted, exit the loop.

I don't believe that insertion/selection sort is easier to grasp. Can you type it from memory, without looking it up? Here's bubble sort:

    var swapped = true
    while swapped:
      swapped = false
      for i in 0 .. list.len-2:
        if list[i] > list[i+1]:
          swap(list[i], list[i+1])
          swapped = true
archargelod··on Rust in the kernel is no longer experimental
One problem of Rust vs C, I rarely see mentioned is that Rust code is hard to work with from other languages. If someone writes a popular C library, you can relatively easily use it in your Java, D, Nim, Rust, Go, Python, Julia, C#, Ruby, ... program.

If someone writes a popular Rust library, it's only going to be useful to Rust projects.

With Rust I don’t even know if it’s possible to make borrow checking work across a language boundary. And Rust doesn't have a stable ABI, so even if you make a DLL, it’ll only work if compiled with the exact same compiler version. *sigh*

archargelod··on Thoughts on Go vs. Rust vs. Zig
This list is missing Nim[1]: nice syntax, extremely fast, memory safe, small binaries

[1] https://nim-lang.org

archargelod··on Be Like Clippy
HN users are predominantly loyal Apple users and most of them are pro-gatekeeping and for walled garden approach.

So, I am not so sure that they're fully aligned with Clippy movement at whole, which is much more than just "right to repair".

archargelod··on Be Like Clippy
What events did you expect?

It's not a revolution, we can't just go with pichforks to Microsoft offices and demand de-enshittification of Windows.

It's a movement of "we are fed up with this shit".And our only tools are:

making people aware of how awful Windows, Mac and rest of Big Tech world are and to make people switch to Linux, because it's the only platform that is free from this bullshit and gives you some freedom.

archargelod··on Be Like Clippy
> As the number of supporters grow, the less “cool” it becomes

Does it really matter if movement is cool or not? I hate corporate bullshit shoving AI down our throats and enshittifying everything it touches, that's why I changed my profile picture to clippy. I, frankly, don't care about character or what's the meaning behind it. But I want for other people to see how many of us are fed up with shit.

>> I've begun to correlate it with people who are more annoying than average

This I don't understand, because in my experience, people with clippy pfp are usually helpful. I usually see them on the top of youtube or reddit comments, giving good advices and answering questions.

archargelod··on Slop Detective – Fight the Slop Syndicate
For me, AI slop is anything that was "vibed" with AI. If all it takes is writing a prompt and pressing a button - it's a sloppy, lazy and should not be the end product, period.

But, you can take what AI generates, refine it, change it or use only parts of it, fact check it, etc. etc. Now, it's still AI generated, but not a "slop".

AI can do 90% of your work, but the other 90% is still your job if you want someone else to care about it.

archargelod··on Someone at YouTube Needs Glasses: The Prophecy Has Been Fulfilled
Most content creators have links to support them with donation or patreon.

Once a year choose 3 small youtubers (larger ones are already multi-millioners, they don't need your help) and drop them $5 each.

Now you just did 1000% of what they could get from you watching ads.

archargelod··on Cool-retro-term: terminal emulator which mimics look and feel of CRTs
Looks nice and pretty light on resources.

But it seems buggy at rendering some unicode characters, I use vertical line[0] for my indentation guides in Neovim, and they look outright hideous in cool-retro-term[1]

[0] https://www.compart.com/en/unicode/U+007C

[1] https://lensdump.com/i/f6qna1

archargelod··on Unofficial "Tier 4" Rust Target for older Windows versions
> Never used Nim before so I might be doing something wrong though.

With Nim on weird targets you usually want:

- OS target = any

- Memory Management = ARC

- malloc instead of default Nim allocator

- turn off signal handler (if not POSIX)

- disable threads (most of the time)

Then look at how C is compiled and copy all compiler+linker flags to your Nim configuration. Here's an absolute minimal `config.nims` I used to compile Nim for C64 with LLVM-MOS[1] toolchain:

    import std/strutils
    
    --cc:clang
    --clang.exe:"mos-c64-clang"
    
    --os:any
    --cpu:avr
    --mm:arc
    
    --threads:off
    --define:usemalloc
    --define:noSignalHandler
    
    let args = [
      "-isystem $PWD/../mos-platform/c64/include",
      "-I$PWD/../mos-platform/c64/asminc",
      "-L$PWD/../mos-platform/c64/lib",
      "-mlto-zp=110",
      "-D__C64__",
    
      "-isystem $PWD/../mos-platform/commodore/include",
      "-I$PWD/../mos-platform/commodore/asminc",
      "-L$PWD/../mos-platform/commodore/lib",
      "-D__CBM__",
    
      "-isystem $PWD/../mos-platform/common/include",
      "-I$PWD/../mos-platform/common/asminc",
      "-L$PWD/../mos-platform/common/lib",
      "--target=mos",
      "-flto",
      "-Os",
      ].join(" ")
    
    switch("passC", args)
    switch("passL", args)
Nim side was easy, because I have already compiled Nim to WASM at that point and the flags are similar. Hard part was figuring out the C compiler flags: e.g. cmake structure and why compiler complains about missing symbols, when they're not missing (answer: include/lib order is very important).

[1] https://github.com/llvm-mos/llvm-mos

archargelod··on Unofficial "Tier 4" Rust Target for older Windows versions
Languages that compile to C (e.g. Nim) are great on older systems. If a system has a working C compiler (or cross-compiler), there’s a good chance that it’ll just work.

I’ve myself compiled Nim on Windows 7, Windows XP, and Haiku, and have run simple Nim programs on the C64 and GameBoy Advance.

archargelod··on How many video games include a marriage proposal? At least one
That reminds me about an easter egg[1] in arcade racing game Horizon Chase. If you trace a heart shape (on mobile device/nintendo switch screen) at the start of the race, it plays a short video with a proposal at the end. Game is very fun too.

[1]https://www.youtube.com/watch?v=yoeKgQifaO4

archargelod··on Giving C a superpower: custom header file (safe_c.h)
You can get all of that and more with Nim[0].

Nim is a language that compiles to C. So it is similar in principle to the "safe_c.h". We get power and speed of C, but in a safe and convenient language.

> It's finally, but for C

Nim has `finally` and `defer` statement that runs code at the end of scope, even if you raise.

> memory that automatically cleans itself up

Nim has ARC[1]:

"ARC is fully deterministic - the compiler automatically injects destructors when it deems that some variable is no longer needed. In this sense, it’s similar to C++ with its destructors (RAII)"

> automated reference counting

See above

> a type-safe, auto-growing vector.

Nim has sequences that are dynamically sized, type and bounds safe

> zero-cost, non-owning views

Nim has openarray, that is also "just a pointer and a length", unfortunately it's usage is limited to parameters. But there is also an experimental view types feature[2]

> explicit, type-safe result

Nim has `Option[T]`[3] in standard library

> self-documenting contracts (requires and ensures)

Nim's assert returns message on raise: `assert(foo > 0, "Foo must be positive")`

> safe, bounds-checked operations

Nim has bounds-checking enabled by default (can be disabled)

> The UNLIKELY() macro tells the compiler which branches are cold, adding zero overhead in hot paths.

Nim has likely / unlikely template[4]

------------------------------------------------------------

[0] https://nim-lang.org

[1] https://nim-lang.org/blog/2020/10/15/introduction-to-arc-orc...

[2] https://nim-lang.org/docs/manual_experimental.html#view-type...

[3] https://nim-lang.org/docs/options.htm

[4] https://nim-lang.org/docs/system.html#likely.t%2Cbool

archargelod··on Why is Zig so cool?
I love Zig. Never tried to write it though =).

I just use a it as cross-compiler for my Nim[0] programs.

[0] - https://nim-lang.org

archargelod··on Nim 2.2.6
If someone stumbles upon this comment, don't be quick to discard the Nim language. Please do your own research and make your own opinion on the matter.

I believe this and many of comments by tinfoilhatter under this post are not in good faith and in the most charitable interpretation written by a uninformed person or are severely outdated.

> Thanks for the offer, but there's a reason why Nim hemorrhages users as fast as it gains them, and a big reason for that, IMO, is the toxic community which definitely includes the moderation team.

I have to challenge this, because for the last couple years, there have been almost no incidents or drama. Moderation was almost exclusively dealing with spam messages. I think, on the forum, a couple posts were closed because of heated or offtopic discussions. But in all cases, participants were agreeing with the decision of mods (you can see them leaving a 'like' on mod's message).

> There was quite a bit of drama that caused the hard fork to materialize. Differences in communication styles is definitely describing the drama that unfolded, extremely mildly. I don't work on the fork or use it, but some of the more talented compiler developers who were previously contributing to Nim, left Nim to go work on Nimskull.

I know that some of people that left were also the ones causing problems with moderation and being toxic. I don't want anyone to draw strong conclusions, but Nim community was much healthier and friendly after the fork people and certain moderator leaving the project.

> He is also very difficult to work with and isn't very welcoming to newcomers. The community "leaders" / moderation team is also full of abrasive individuals with fragile egos.

This is just false. You can see Araq answering the noob questions on the forum all the time. He might be not the best person to do that, because his answers on the short side. I believe, noobs often need more context, examples and explanations than he's providing. But it's thought and effort that counts. Some people even hate when you treat them as complete beginner and try to nourture them common CS knowledge.

archargelod··on Nim 2.2.6
> Nim unfortunately has a toxic Dictator at the top

Araq has opinions that he defends, but you can and absolutely should try to sway or change them. I see this all the time on Discord and Forum. And I see people win over just as much as them losing.

I don't have a strong opinion if this is healthy or not, but it's probably why I would be a bad BDFL =). All in all, I don't think dictatorship is a right word here.

archargelod··on What we talk about when we talk about sideloading
There are countries like China, Russia, Iran, and Venezuela where installing an APK is the primary or only way to get most software, including essential bank and government apps.

Outside of the Western market, installing Android apps not from Google Play is a completely normal and regular thing. In countries like India, Brazil, Indonesia, Nigeria, and the Philippines (which represent a massive portion of global Android users) it is a standard part of using a phone.

archargelod··on What we talk about when we talk about sideloading
Did you consider piracy?

I'd guesstimate that close to 50% of Android users know how to install an apk.

archargelod··on What we talk about when we talk about sideloading
Google camera is not exclusive to Pixel.

It was ported[0] by enthusiasts to literary almost every Android phone. I have it on my $100 Xiaomi.

[0] https://xdaforums.com/tags/google-camera/

archargelod··on Wren: A classy little scripting language
Most recent commit on the github[0] was only 11 months ago.

Also, it's not a javascript framework, a stable software doesn't have to update often. Look at Lua, most people still use Lua 5.1 and that was released in 2006.

[0] https://github.com/albertodemichelis/squirrel

← PreviousPage 4 of 10Next →