3 ms·
Most of the author's criticisms around the Unix Philosophy™ (aside from perhaps the performance aspect) would be solvable in two steps: 1) Standardize on some
by yellowapple 10y ago
Most of the author's criticisms around the Unix Philosophy™ (aside from perhaps the performance aspect) would be solvable in two steps:
1) Standardize on some structured text serialization format (I like YAML for this)
2) Write a new shell
Both of these things are compatible with the Unix Philosophy™, and thus said Philosophy is nowhere near collapse. Rusty around the edges, sure, and maybe with some asbestos in the ceiling tiles, but certainly renovatable.
The philosophy is already prevalent in the world of "microservices"; an application is split into a whole bunch of independent (usually containerized) programs communicating via something like JSON over HTTP.
- jstimpfle 10y agoOne format for all use cases? Databases (passwd,group...), single-word files, key-value(-list?) files, rc files for a thousand programs? Great idea! We should use XML for that...
- yellowapple 10y agoI meant that more in terms of IPC (e.g. in pipes), but most of those use cases happen to be adequately handleable by YAML specifically, so yeah, why not?
- darkr 10y agoIdeally a simplified subset of YAML; the full specification suffers from feature creep and has actual bugs.
- yellowapple 10y agoStrictYAML ( https://github.com/crdoconnor/strictyaml https://github.com/crdoconnor/strictyaml ) looks promising to that effect.
- TeMPOraL 10y agoXML, YAML, JSON and s-expressions are all just flavours of representing trees. So yeah, any of that would be a much better idea than unstructured text, and yes, you can serialize all those use cases into trees. I'd steer away from XML for sake of efficiency and human-readability though.
- jstimpfle 10y agoNot everything is a tree, and neither XML nor JSON nor sexp are particularly efficient or "beautiful". And there is no canonic representation. You could strip all whitespace or indent all childs, but... And YAML for example has no nice way to put lists of single words on one line.
- TeMPOraL 10y agoI'm yet to see a practical data set that could not be encoded as a tree. Maybe if you have a cyclical data structure and you want to save that directly, but then it's a simple meta-level extension. For example, Lisp reader does that when reading S-expressions. If you want to create a list like this: 1 ---> 2 ---> 3-| ^_______________| you write: #1=(1 2 3 #1#), where #n=OBJECT means "this is the object N", and #n# means "here is the very same object N too".
- jstimpfle 10y agoYes, you can encode everything "as a tree". You can also encode everything "as binary", "as a big integer", whatever. That doesn't mean it's a good idea.
- yellowapple 10y agoUnlike "as binary" or "as a big integer", a tree is structured. "As an arbitrarily-formatted string" would be much closer to those two comparison points.
- jstimpfle 10y ago
- qznc 10y agoIt does not fix the thing right below the shell: the terminal. The terminal is responsible for hacks upon hacks: Colors, ncurses, signals, and whatnot.
- chubot 10y ago2) I'm writing a new shell! http://www.oilshell.org/blog/ http://www.oilshell.org/blog/ 1) This is an appealing idea, but my claim is that there's no single serialization format that will work. (Or if there is one, it has yet to be invented.) More detail here: https://www.reddit.com/r/oilshell/comments/5x5rgg/pipes_in_plan9_used_to_take_structured_data_not/ https://www.reddit.com/r/oilshell/comments/5x5rgg/pipes_in_p... There's nothing stopping anyone from using structured data over pipes, but I think it's a mistake to assume there will be or needs to be a "standard". 3) I agree that JSON over HTTP is very much in the vein of Unix. The REST architecture has a very large overlap with the Unix philosophy -- in particular, everything is a hierarchical namespace, and you have a limited number of verbs (GET / POST vs. read() / write() ).
- yellowapple 10y ago"There's nothing stopping anyone from using structured data over pipes, but I think it's a mistake to assume there will be or needs to be a 'standard'." Then I'm not sure how the problem would be solved. The main reason why "everything should be plaintext" is problematic (aside from being inefficient storage-wise) is that there's no "standard" format. My interpretation of the article's criticisms is that overreliance on tools like awk is the problem, not the solution. Hence, the recommendation to just standardize on YAML (or some stricter subset thereof). If unstructured data is really needed in the pipeline, then it can easily be encapsulated in an ordinary YAML document. This would unify the strengths of the Unix way (ease of human inspection) and the PowerShell way (ease of plugging arbitrary tools together without needing to stick a bunch of text filters all over the place).