Live data from Hacker News

Functional programmers need to take a look at Zig

pure-systems.org

141–150 of 163 posts

Re: Functional programmers need to take a look at Zig

#141

My stack today is kinda nice but perhaps a bit odd: - Go - backend + CLIs - TypeScript - fronted, occasionally zx for more complex scripts - Nushell as my scripting language (I’ve been relentlessly using it everywhere I can instead of bash/zsh and man it is such an improvement) I heard so much good stuff about both Zig and Rust and would love to eventually get to know one of them.

nushell + 1. After ~20 years of bash+zsh, I'm translating all my scripts to nu. Yesterday I noticed I still don't know how to write ls | where modified in zsh after all years.

I use fish as daily shell, and for this kind of script I would rather jump to ruby. But it looks rather readable.

Re: Functional programmers need to take a look at Zig

#142
post #104

These days I just use a few languages: 1. Go, when I first saw code I wrote almost a decade ago still compiles and runs in Go, I decided to use Go for everything. There were some initial troubles when I started using it a decade ago, but now it's painless. 2. Haskell, I use it for DSL and state machines. 3. Bash for all deployment scripts and everything. 4. TypeScript, well for the frontend. Lately, I’ve been using G…

Well, Java would compile and work for 3 decades straight. If anything, go did have an actual breaking language change (for loop variable capture)

This has never been my experience. Have you ever tried to run a minecraft server or something similar? Minor version differences in the JVM result in unpredictable crashes.

Re: Functional programmers need to take a look at Zig

#143
post #104

Earlier quoted context omitted.

Well, Java would compile and work for 3 decades straight. If anything, go did have an actual breaking language change (for loop variable capture)

This has never been my experience. Have you ever tried to run a minecraft server or something similar? Minor version differences in the JVM result in unpredictable crashes.

I assume some of the extensions/plugins use internals for maximal performance or whatever?

But the platform itself is extremely backwards compatible, you can find some old jar file created for a university course that still runs without an issue. Of course if you have a bunch of libraries that may so stuff like touch internal details, you lose some of that compatibility (sun.misc.unsafe package can access some internal details, memory). Recently even this latter has been locked down more and more, so maybe that's one reason for your experience (e.g. previously one could set a private field to public and access it, now you can only do that if you explicitly give a flag)

And given that Minecraft was (is?) proprietary, reverse engineered code base where plugins were hacked into, I guess this brittleness makes sense.

Re: Functional programmers need to take a look at Zig

#144

These days I just use a few languages: 1. Go, when I first saw code I wrote almost a decade ago still compiles and runs in Go, I decided to use Go for everything. There were some initial troubles when I started using it a decade ago, but now it's painless. 2. Haskell, I use it for DSL and state machines. 3. Bash for all deployment scripts and everything. 4. TypeScript, well for the frontend. Lately, I’ve been using G…

Im with you on Go and SQLite, dropped Postgres for many of my projects, I might add: HTMX instead of a TS frontend, very few apps need a TS/React/... frontend. Doubling development effort with minimal gain (except games etc.) Dabbled with Rust some years ago, I think it is an excellent choice for sudo-rs and such but for GUI and web apps I (perhaps too stupid) end up with arcmutex soup. https://www.radicalsimpli.city

The sentiment on that page speaks to my soul. But I wonder how relevant it still is, just a few years later, in the age of AI tools?

Certainly replacing a microservices morass with a single bare metal server running a single static go binary makes good fiscally responsible sense for a startup/MVP. But how does a CTO make the case that "we don't need React" when the developer can just get Claude to smack the React app around with a trout until it does what you want?

Basecamp may have done it but I get the feeling that's a major outlier.

Re: Functional programmers need to take a look at Zig

#145

These days I just use a few languages: 1. Go, when I first saw code I wrote almost a decade ago still compiles and runs in Go, I decided to use Go for everything. There were some initial troubles when I started using it a decade ago, but now it's painless. 2. Haskell, I use it for DSL and state machines. 3. Bash for all deployment scripts and everything. 4. TypeScript, well for the frontend. Lately, I’ve been using G…

That sounds really nice. I have a couple of Haskell servers running on VMs, but the build requirements really slow down the process. I have to use dockers to help cache dependencies and avoid recompiling things that have not changed, but it is still slow and puts out large binaries.

The idea of having a language with most the batteries for a web server built-in is nice. I've never considered Golang, but it is compelling. I'll have to check it out. Though Rust keeps catching my eyes.

Re: Functional programmers need to take a look at Zig

#146

My stack today is kinda nice but perhaps a bit odd: - Go - backend + CLIs - TypeScript - fronted, occasionally zx for more complex scripts - Nushell as my scripting language (I’ve been relentlessly using it everywhere I can instead of bash/zsh and man it is such an improvement) I heard so much good stuff about both Zig and Rust and would love to eventually get to know one of them.

nushell + 1. After ~20 years of bash+zsh, I'm translating all my scripts to nu. Yesterday I noticed I still don't know how to write ls | where modified in zsh after all years.

Whoa. You people freak me out with your fancy new toys.

Re: Functional programmers need to take a look at Zig

#147

I am still hearing about Monads, but is it not the case that they have well-known flaws? And that is the reason why algebraic effects are interesting, because they don't have these flaws?

The biggest problem with monads that I am aware of is that they don't compose: if m1 and m2 are monads, then you can't automatically derive a new monad m3 where m1 (m2 a) and m3 a are equivalent.

Monad transformers are one solution to this. This lets you write the composition rules for m2 once, and then reuse them for every m1. A solution, but boilerplatey.

I don't understand algebraic effects quite as well, but my understanding is that they do simply compose.

Re: Functional programmers need to take a look at Zig

#148
post #126

Earlier quoted context omitted.

When i talk about my "bash" scripts, i mean sh. I assume this is the same forgp (tbh, i tend to use AWK over bash in 80% of cases, but i call it from bash anyway, and still call it bash scripting :/)

> tbh, i tend to use AWK over bash in 80% of cases, but i call it from bash anyway, and still call it bash scripting :/ This makes me sad and sounds very naive. AWK is a fantastic language on its own and should be called out when used as such.

I'll make you sadder: Even when I call my own AWK modules I put hours in, I still call that a bash script.

Re: Functional programmers need to take a look at Zig

#149

These days I just use a few languages: 1. Go, when I first saw code I wrote almost a decade ago still compiles and runs in Go, I decided to use Go for everything. There were some initial troubles when I started using it a decade ago, but now it's painless. 2. Haskell, I use it for DSL and state machines. 3. Bash for all deployment scripts and everything. 4. TypeScript, well for the frontend. Lately, I’ve been using G…

That sounds really nice. I have a couple of Haskell servers running on VMs, but the build requirements really slow down the process. I have to use dockers to help cache dependencies and avoid recompiling things that have not changed, but it is still slow and puts out large binaries. The idea of having a language with most the batteries for a web server built-in is nice. I've never considered Golang, but it is compell…

> I have to use dockers to help cache dependencies and avoid recompiling things that have not changed, but it is still slow and puts out large binaries.

This is actually the biggest pain point I am running into as well, which significantly slows down the speed of deployment.

Re: Functional programmers need to take a look at Zig

#150
post #93

My stack today is kinda nice but perhaps a bit odd: - Go - backend + CLIs - TypeScript - fronted, occasionally zx for more complex scripts - Nushell as my scripting language (I’ve been relentlessly using it everywhere I can instead of bash/zsh and man it is such an improvement) I heard so much good stuff about both Zig and Rust and would love to eventually get to know one of them.

Nushell, from their website, looks a lot like PowerShell's idea of a shell, but less verbose.

PowerShell is not really that much more verbose. This is the equivalent of the nushell command by crabsand.

  dir | ? LastWriteTime -lt (Get-Date).AddDays(-21) | del
Post reply on HN