Ignorant thoughts #563
Replies: 6 comments 2 replies
-
Thanks for the feedback! I'll need to get to it (needs some thinking and processing). Currently I'm very limited time-wise. |
Beta Was this translation helpful? Give feedback.
-
Executables & DSL
I think we should get into details here. What do you think should be supported exactly?
Hmm.. That's somewhat surprising to me. Shell is a DSL. What's more natural than having domain specific types? For example
... kind of part of "standard library" in bash, except that the library as a whole and in particular is not that standard . Anyhow, there is nothing wrong with Edit: I'll be replying to other parts as time allows |
Beta Was this translation helpful? Give feedback.
-
UFCSUFCS is supported in NGS. Together with multiple-dispatch it is at the core of the language. From https://brevzin.github.io/c++/2019/08/22/ufcs-custom-extension/
None of which seem to be applicable. That's the advantage of green field language design. Support UFCS from the start and you are an pretty good shape. NGS does not have classes. There are only types and methods. Method calls support UFCS. |
Beta Was this translation helpful? Give feedback.
-
Result typesOne of the guiding principles in NGS is that "small scripts don't suffer". In case of error handling that manifests as exceptions. In many cases you don't care about errors and you just want the script to stop when one occurs. That's exactly what happens with exceptions.
In practice though, for me, the use of these is pretty rare compared to exceptions. I am open to specific proposals about result types for NGS though. I think that CS is not there yet and both exceptions and result types are subpar solutions. From the two bad solutions I picked the one that was less bad in my opinion. |
Beta Was this translation helpful? Give feedback.
-
bash
I would like to add some points from my perspective (in order of importance):
Edit: also treating your terminal as dumpster that mixes stdout+stderr from multiple processes and doesn't limit the amount of output to human-processable amount. |
Beta Was this translation helpful? Give feedback.
-
Sorry, I was kind of having a mental break down and shouldn't have written that. I don't think any of my input will be valuable, but I'll give some follow up thoughts to show my support.
I think a new style/syntax for command substitutions, piping, and redirection could be invented using ideas from haskell's do notation. The relevant part of the UFCS post was towards the end, which talks gives a starting point for how this could be done.
i.e. for command substitution, one could expand upon something like
I believe that Food for thought
|
Beta Was this translation helpful? Give feedback.
-
In a DSL for shell scripting, executables should be first class citizens. I think Haskell's function call syntax could be used and executables could then be treated as variadic functions (or just a monadic function taking a string).
I think the unix philosophy should be more tightly adhered to. I don't want to learn DSL specific function names like
Program
when I just could do
I think result/error types should be used instead of exceptions, but you need to have succinct monadic composition of these https://github.com/TartanLlama/optional
In general, I think you can learn a lot from recent c++ proposals, they're stealing the useful parts from functional programming and trying to make the language "pythonic" https://brevzin.github.io/c++/2019/08/22/ufcs-custom-extension/
The minimalism of Luna and Nix Expression Language is a good thing for a DSL (although I think their type systems need a sum type).
I think bash does a lot right. What bash does wrong is scoping and type safety. Closures/lambdas/destructuring would be needed to tighten up the scoping. And I want to be kept safe from mixing expressions and strings.
Also you may want to improve you SEO by changing the github description. I had trouble finding this project. I was googling
shell scripting language
,shell DSL
, andbash replacement
.Beta Was this translation helpful? Give feedback.
All reactions