4 ms·
Yes, you are correct. The very intuitive approach we took on decision making is the key point of the language. I came up with this idea of designing a language
by mertyildiran 6y ago
Yes, you are correct. The very intuitive approach we took on decision making is the key point of the language.
I came up with this idea of designing a language with no "if" after dealing with various untestable codebases for years. They were literally untestable because of the technical debt caused by the extensive amount of "if" usage in the function bodies, especially the guard clauses makes it 1 "if" minimum for almost every functions. So at the end I have exhausted because of the if(s) and decided to create a language that forces you to have minimum technical debt.
- jandrese 6y agoI'm still not convinced it doesn't just sweep the complexity under the rug. Ultimately you still need to branch unless you only want the language to do pure mathematical computation or something like that. Only now every branch needs to be hidden in a function call.
- pmontra 6y agoI have a large Elixir project with less than 10 branches (if then else) and they were written by other developers. Conditional logic is done either in pattern matching in function definitions (and some guard) or case/cond or with/else. I guess case/cond can be implemented with the return mechanism of Chaos. Maybe it's going to feel weird, maybe not. There is no pattern matching and I got the feeling that's going to complicate things but again, it can be emulated to some degree but the return mechanism. Instead of def a(0), do: "a" def a(1), do: "b" def a(_n), do: "c" Probably we'll be writing str def a(n) num x = n end { x == 0 : "a" x == 1 : "b" default: "c" } Having to define that x variable feels like a waste of code and reasoning on x instead of n (the argument of the function) is a pity. Maybe the function body can be empty. I didn't install the language. I wonder how that scales on real world cases, for example matching the internals of some complex data structure.
- curryst 6y agoPattern matching is still branching. An elegant way of expressing it, but it is branching none the less.
- imtringued 6y agoI am now wondering what the benefit of Chaos' approach is. Chaos is making some pretty substantial tradeoffs. Going with conventional pattern matching (as part of the declaration) isn't such a big leap.