5 ms·
> it's clearly not expressive enough for general purpose programming The problem of persisting arrays usually leads to handling them in bash. Now you have two
by heresie-dabord 5y ago
> it's clearly not expressive enough for general purpose programming
The problem of persisting arrays usually leads to handling them in bash.
Now you have two problems.[1]
[1] If you paraphrase Jamie Zawinski in an explanation, you then have two things to explain.
- chubot 5y agoNot sure what you mean because bash has the same problem -- you can't return an array from a function. And I still think Shell, Awk, and Make Should be Combined. In that world you'd still have one problem :) https://www.oilshell.org/blog/tags.html?tag=awk#awk https://www.oilshell.org/blog/tags.html?tag=awk#awk Oil has recursive data structures, although I'm still working out how to compose shell-like "procs" and functions which could return an associative array. We could just add them both naively but I think it would cause many shell programs to be a lot messier.
- emidln 5y agoYou don't have to in bash because you can just declare that your array is global inside your function. In fact, this is the default behavior.
- chubot 5y agoSure but you can also declare global arrays in Awk. The point is that Awk and bash are the same in several respects, so you don't really gain anything by switching to one or the other: - they don't have any garbage collection or ref counting - they don't have recursive data structures - you can't return any kind of array from a function In bash you also can't pass an array to a function, but in Awk you can.