-
Notifications
You must be signed in to change notification settings - Fork 238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
encourage dataflow programmers to switch to streem from shell #36
Comments
👍 This is a good idea |
While I don't like a lot of syntax in standard shells, and while Streem would make things a lot nicer syntactically, I think this is a pretty big goal. In my opinion, this would make Streem too complicated. This would bring a lot of reserved words and weird syntax into Streem (for example, the tons of different conditional statements you can have in bash, and weird semantics with spaces in variables). I think that being able to have nicer syntax for common tasks would be more useful than having full shell support, especially since more explicit syntax sugar could easily be added for calling shell commands (like I like the idea of having a shell for Streem. However, pulling commands that could conflict with Streem functions could be confusing, especially if something is actually a shell builtin but seems like a normal command. I personally disagree with the goal of making Streem a full shell compatible with bash/zsh/etc. For example, what happens if someone calls
This could make syntax more confusing, as parenthesis (while somewhat ugly) make things more obvious. However, we could theoretically do something like what Haskell does (where arguments don't need parenthesis or commas, but you can use currying). That could be pretty interesting, especially if Streem would curry by default (like Haskell).
While
This sounds like a pretty flexible idea. |
@nicolasmccurdy I'm going to attempt to clarify, as I think there is some confusion about what I'm proposing. For instance, I didn't intend to imply this at all:
I am not suggesting some kind of merge of the reserved words and syntax from shell. Streem should stand as its own language. My suggestion is that it borrow the most-useful stream and dataflow-oriented idioms from shell. These do not include logical control structures in shells, which are so annoying to use that even experienced users of unix shells typically drop into more syntactically consistent languages when writing applications that include more than a few if statements. I agree this would make things very complicated, but for that reason it's not what I propose.
I agree. Different system shells aren't even completely compatible with each other, so this would seem an impossible and sisyphean goal. I mean that streem, with its own syntax and conventions, should still be perfectly usable as a replacement for other systems shells. Let me try to refine the idea:
(1) would allow a streem REPL to be used in place of a system shell for basic file management, data inspection, and system navigation. The result would be an interactive setting in which pipelines can be prototyped quickly. As this is currently the case for shell, streem could only do worse by not enabling this kind of work. (2) provides convenience that really matters for interactive work, and it builds up a particular way of working with data that is familiar to almost everyone who seeks to do with shell what they might someday better do with streem. The basic idea is that someone familiar with bash, tcsh, or zsh could sit down and navigate the filesystem, inspect data, and run some basic processing tasks in streem with exactly the same ease as they currently can in shell. This means that commands in the path are exposed as functions in streem, and "just do" what you expect them to. I'm focusing on the usability standpoint, which suggests to me a particular, undecorated, command syntax. As you note, currying could be an interesting paradigm to manage this:
This might be an approach to rationalize this kind of organization and improve interactive usability. On the other hand, in the design I'm describing we are left with the issue of variable escaping. Perhaps a |
👍👍 When streem is done, I'm not sticking around with bash anymore! |
I do a lot of flow-oriented programming in shell, so I'm interested in streem as a replacement for the traditional unix shell. (I use zsh, but the differences are minimal enough in this sense that we can talk about shell generally.)
Unix shell scripting was designed from the very beginning with flow-oriented programming is mind. However, while it is trivial to make pipelines in shell, it is not easy to construct logically-driven stream processing functions, where data flows are managed directly using code written in shell. There are a number of workarounds. Often it's easiest to write such functions in other languages and glue them together in shell. Take, for instance, the universe of perl, awk, and sed one-liners that litter an old web of ~user pages and persist in the various stackexchanges and github. I think this is very much a path-dependent situation that relates to the difficulty of writing an efficient, interactive, and interpreted language.
Despite its age and cruft, shell has a huge following in data-oriented science, where I imagine streem would have the greatest impact. These are exactly the users we'd like to attract, and the most complete form of capture would be if they switched from using bash, zsh, and tcsh to using streem itself. I don't think this would be too difficult to achieve, and would have little bearing on the functionality delivered by the language. It would have an effect on its usability.
I propose that streem adopts command syntax that would enable a streem REPL to be used in place of a traditional unix shell. In my mind, this would imply a few basic considerations:
[command] [arg]*
syntax. In other words, it shouldn't require the use of parentheses for every function call.[command] [arg]* >[file-or-function]
.>
rather than|
to allow for forks and clarify the type of the sink that is being used (is it conceptually a named pipe, a file, or a function). For example,>@
could indicate forking/splitting a pipeline into a named streem function or command.&
for spawning subprocesses and job control.The idea isn't to remain compliant with *nix standards, but to make an environment which is attractive to the largest group of people who are currently using flow-oriented patterns.
The text was updated successfully, but these errors were encountered: