A functional programmer who casts away proper sum types and pattern matching is no functional programmer at all
I thought lisps were all functional programming, and lack sum types and pattern matching? In which case, what's the term for the "proper sum types and pattern matching" flavour of things?
Functional programmers need to take a look at Zig
81–90 of 163 posts
Re: Functional programmers need to take a look at Zig
#82While using "monads" in functional languages is a neat trick, I do not like them. In my opinion, the concept of automaton is fundamental and it deserves equal standing with the concept of function (even if it is a higher level concept that is built upon that of function). I believe that functional programming is preferable wherever it is naturally applicable, and most programs have components of this kind, but most c…
Re: Functional programmers need to take a look at Zig
#83Earlier 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.
In such context, I think Go might be a better or at least, more realistic, compromise in most cases.
Re: Functional programmers need to take a look at Zig
#84I am definitely in the minority here, but I am not a fan of the kind of meta-programming that Zig and Rust offer, with Rust being especially atrocious. In the two decades I've been programming I can count on one hand the number of times meta-programming was an appropriate solution to a problem I had. Every time I reached for it, I got bit. There's a reason "when in doubt, use brute force" is sage advice, it may not be fast and glamorous, but it'll be a hell of a lot less opaque.
Re: Functional programmers need to take a look at Zig
#85Earlier quoted context omitted.
I don't think so, where's the extra information in the Zig example? In Rust, which is arguably also a low level language, it looks like this: enum Option { None, Some(T), }
Low-level doesn’t mean more information, it means more explicit. In Zig, that means being able to use the language itself to express type level computations. Instead of Rust’s an angle brackets and trait constraints and derive syntax. Or C++ templates. Sure, it won’t beat a language with sugar for the exact thing you’re doing, but the whole point is that you’re a layer below the sugar and can do more. Option is trivi…
I don't see how any of that becomes easier in the Zig case. It's just extra syntactic ceremony. The Rust version conveys the exact same information.
Re: Functional programmers need to take a look at Zig
#86Earlier 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…
well there's your answer, isn't it?
Re: Functional programmers need to take a look at Zig
#87Re: Functional programmers need to take a look at Zig
#88These 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…
Re: Functional programmers need to take a look at Zig
#89These 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…
I went the same way but with only using Lisp dialects like Elisp and Clojure and Nix. Although I would ditch Nix too if another Lisp could supplant it too.
Re: Functional programmers need to take a look at Zig
#90Earlier quoted context omitted.
"slightly different ways to initialise stuff." can you elaborate? theres only what 11 datatypes in elixir?
Perhaps they are referring to the syntactic sugar around keyword lists? [a: 1, b: 2] == [{:a, 1}, {:b, 2}] Or maybe atom vs string keys in maps? %{a: 1} vs %{"b" => 1} Or keyword lists always needing to come last in lists? [some: :value, :another] # error [:another, some: :value] # valid Or maybe something else entirely. Those are just things I remember having to lookup repeatedly when I was first learning elixir.