3 ms·
“Swift Syntax is Poorly Suited for Functional Programming“ - sad but very true. On the other hand it’s a weird statement to make in an article about Zig, becau
by zepto 6y ago
“Swift Syntax is Poorly Suited for Functional Programming“ - sad but very true.
On the other hand it’s a weird statement to make in an article about Zig, because Zig is much worse.
- jdmoreira 6y agoI was surprised by the statement since I use Swift mostly as a functional programming language. Sure you need to avoid classes and restrict yourself to value types but I enjoy the syntax. Immutability is guaranteed, closure syntax is not that clunky, the type system is great, extensions are amazing for namespacing and protocols / generics solve all my polymorphism needs. The language is huge though and getting bigger (which I don’t enjoy).
- zepto 6y agoI like Swift more than any other curly brace language, and I use it for functional programming. I have pure Swift apps in the App Store and continue to work on Swift projects. But compared to something like OCaml or Haskell, the syntax is just plain nasty for real fp. It feels clumsy and verbose - like wearing a pair of hob-nail boots for ballet dancing. However, I think they made a good trade off in terms of balancing readability, power and progressive disclosure.
- johnnycerberus 6y agoI wouldn't call OCaml or Haskell languages with nice syntax either. Are they powerful? Yes, but the syntax is not very appealing.
- dnautics 6y agoBeing a avid user of functional programming and Zig, I don't find zig's syntax to be particularly bad for FP, though I don't typically program zig in an FP style. Could you be a bit more specific about what you mean?... (I have done this: https://www.youtube.com/watch?v=fIxNEILcNGM https://www.youtube.com/watch?v=fIxNEILcNGM) And I have coded Zig in a style that resembles Elixir code, which is basically: "use a different style for casing, never use the self syntactic sugar".