Live data from Hacker News

Functional programmers need to take a look at Zig

pure-systems.org

51–60 of 163 posts

Re: Functional programmers need to take a look at Zig

#52
post #51

Maybe procedural programmers should take a look instead. I don't see functions. a function from a set X to a set Y assigns to each element of X exactly one element of Y. [ https://en.wikipedia.org/wiki/Function_(mathematics) ]

Under this strict definition you can’t even throw exceptions!

Re: Functional programmers need to take a look at Zig

#53

Earlier quoted context omitted.

Why did you give up on Java and Rust?

Java is a resource hog when you use patterns and libraries popular in Java land. When you are working in the Java ecosystem, you just assume that this much resource is needed by the app! But when you'll code the same thing in Go using the same methods, you'll find resource usage is really very low. We’ve a 1: 1 copy of the app; on JVM, it's using 2GB RAM using Spring Boot, and on Go, it runs on 512MB RAM and is blazi…

I cant really agree on Rust. It does take a bit more time to write the same code in rust vs go. But in my experience the code is much more likely to be incorrect in go than it is in rust. Which over longer periods means rust is easier to maintain.

Re: Functional programmers need to take a look at Zig

#54
post #52
post #51

Maybe procedural programmers should take a look instead. I don't see functions. a function from a set X to a set Y assigns to each element of X exactly one element of Y. [ https://en.wikipedia.org/wiki/Function_(mathematics) ]

Under this strict definition you can’t even throw exceptions!

Of course you can: you just have to define it in your type. The output set becomes a union type of the normal output and whatever you want as an exception.

If you write this as a monad, your get very similar syntax to procedural code.

Re: Functional programmers need to take a look at Zig

#57

Earlier quoted context omitted.

What’s up with the last paragraph? Nobody is complaining because the BEAM is good enough for the typical use case?

because you're not reaching for elixir when you need performance. btw we do sometimes bitch about performance :)

But then we have ports/NIFs etc that shell out to Rust & Zig ...

Re: Functional programmers need to take a look at Zig

#58

Earlier quoted context omitted.

What’s up with the last paragraph? Nobody is complaining because the BEAM is good enough for the typical use case?

because you're not reaching for elixir when you need performance. btw we do sometimes bitch about performance :)

I asked because I do it sometimes too.

Re: Functional programmers need to take a look at Zig

#59

Earlier quoted context omitted.

because you're not reaching for elixir when you need performance. btw we do sometimes bitch about performance :)

But then we have ports/NIFs etc that shell out to Rust & Zig ...

Not a silver bullet. There are also C nodes but they’re used even less.

Re: Functional programmers need to take a look at Zig

#60

Earlier quoted context omitted.

Java is a resource hog when you use patterns and libraries popular in Java land. When you are working in the Java ecosystem, you just assume that this much resource is needed by the app! But when you'll code the same thing in Go using the same methods, you'll find resource usage is really very low. We’ve a 1: 1 copy of the app; on JVM, it's using 2GB RAM using Spring Boot, and on Go, it runs on 512MB RAM and is blazi…

I cant really agree on Rust. It does take a bit more time to write the same code in rust vs go. But in my experience the code is much more likely to be incorrect in go than it is in rust. Which over longer periods means rust is easier to maintain.

This article convinced me to switch from Go to Rust: https://discord.com/blog/why-discord-is-switching-from-go-to...
Post reply on HN