1. 2

    The title is a little misleading as Oil is yet another shell, so it’s not so much “improving a Bash script using Oil” as it is “replacing a Bash script with an Oil script”.

    1. 2

      That’s true, but you can also use Oil just to improve a bash script… just parsing or running it with Oil may make the script more comprehensible, and less reliant on the vagaries of bash (which do change from version to version). Example with a Lisp in bash:

      http://www.oilshell.org/blog/2020/06/release-0.8.pre6.html#patch-to-run-the-mal-lisp

    1. 2

      Interesting project! It seems like a very similar system to warp directory, what are the advantages of using goto instead of wd?

      1. 3

        The idea has come up quite a bit over the years, at varying levels of quality. https://github.com/huyng/bashmarks is the old version of it I’ve seen, but isn’t friendly to file paths with spaces.

        I ended up making 3 versions of something similar for myself, one in bash, one in Go, and then I ported the database manager to Nim. I’ve started to see it as the shell equivalent of making your own blogging software, and a great way to make your shell suck a lot less.

        1. 2

          Thanks for bringing warp to my attention. I didn’t know about it, goto indeed looks very similar to it. I am not familiar with zsh and I can’t fully compare them, I built goto for the Bash shell, its zsh functionality was added by contributors. If I find the time, I’ll give warp a try and come back to you.

        1. 6

          This is dangerous, as you are now potentially telling people their name is not actually their name. You link to the Falsehoods Programmers Believe About Names in the article itself, but I would still like to point out number 12:

          People’s names are case sensitive.

          and number 13:

          People’s names are case insensitive.

          Trying to capitalise names based on what you believe to be correct does not guarantee it actually is correct. Telling someone called “Jack MCK” they are actually called “Jack McK” would be incorrect, but would be the result this script gives you. Serving them a page with their name incorrectly capitalised can be hurtful, especially because they did enter it correctly themselves.

          1. 4

            That’s indeed what’s also said in the article itself. It notes that you might just use the snippet for suggesting a normalized format, letting a user decide which form is correct.

            1. 5

              But why assume it’s incorrect in the first place? You would still be telling them “hey I believe your name is incorrect, do you actually know how to spell your own name?”.

          1. 8

            Maybe I’m missing something, but I don’t see how this is the first draft of an HTML successor? Isn’t this just a meta language to abstract over HTML in its current form?

            1. 2

              Today this compiles to HTML.

              But in the future browser engines could just parse this directly. I also have one for CSS called Hakon, http://treenotation.org/sandbox/build/#hakon, and there are a few in progress for Javascript. So in the future you could have 1 syntax for all the languages. Your HTML IDs would leverage the same typing information used by your CSS and your Javascript–no more bugs due do having to duplicate that kind of information.

              So I see this in the long term as the beginning of the successor to the HTML/CSS/JS stack.

              1. 12

                That looks like a DTD, except with a Pythonesque syntax instead of SGML.

                I don’t see where there’s value in it for HTML. It may be a neat macro language, but it seems quite presumptuous to call it a successor. HTML survived browser wars, pre-WHATWG useless specs, XHTML and XHTML2. It’s used for interoperability and compatibility with the massive amount of existing content. Such strong network effects are generally impossible to break with same-but-better things.

                1. 1

                  Thank you for the comments and all very fair points.

                  “HTML survived browser wars….”

                  HTML, created by Berners-Lee, came out around 1990. XHTML in 2000. So HTML is about 30 years old.

                  Binary Notation, as formulated by Leibniz, came out in 1689. So over 300 years old.

                  Tree Notation is more like “Binary Notation” than it is a programming language. Just as binary is the simplest way to encode information, Tree Notation is the simplest way to encode abstraction. You cannot improve upon it, and in trying to improve upon HTML/XML/Lisp/any other language people will keep reducing until they reach Tree Notation.

                  HTML survived for 30 years but I don’t think in 30 years we’ll be using it. We’ll have switched to Tree Languages. (Or perhaps, in 30 years will have switched to Tree Languages and then to something else even better that I can’t foresee).

                  “Such strong network effects”

                  Tree Notation will also have very strong network effects over time. A few years ago it was just an idea, but now in an hour you can create a whole new Tree language in Tree Notation and get a parser, compiler, VM, syntax highlighting, autocomplete, program synthesis, type checking, visualization, and a whole lot more.

                  “it seems quite presumptuous”

                  When you discover what is comparable to a new fundamental law of physics, and confirm your discovery over many years with immense amounts of data and experiments, you have 3 options: 1) don’t tell anyone, 2) tell people but lie and say it will not cause a massive paradigm shift 3) tell people the truth and be accused of madness/arrogance/presumptuousness. I’ve decided option 3 is the lesser of 3 evils. It’s a long and lonely road but a few people have been immensely helpful and we are making great progress!

                  1. 11

                    You cannot improve upon it,

                    Reminds me of the kind of language used in all those advertisements for quack medicinal products in centuries past.

                    HTML survived for 30 years but I don’t think in 30 years we’ll be using it. We’ll have switched to Tree Languages.

                    This is so incredibly off-base it verges on delusion.

                    in an hour you can create a whole new Tree language in Tree Notation and get a parser, compiler, VM, syntax highlighting, autocomplete, program synthesis, type checking, visualization, and a whole lot more.

                    I don’t think anyone would want to use them, and it’s not possible to generalise the creation of usefully distinguishable VMs.

                    There are no actual evils in your three options, but the third will certainly lead to people ignoring you. If you consider the opposite of evil to be people enjoying and appreciating your creation, then it’s definitely not the lesser of the three; try option 2.

                    1. 2

                      Reminds me of the kind of language used in all those advertisements for quack medicinal products in centuries past.

                      I think this is a very healthy attitude to have. Probably 99/100 times someone says something like that they are full of it, so it is safe to ignore them. I’m not asking you to believe. I’m asking people to try your best to prove me wrong.

                      Can you improve upon binary notation? Can you come up with a simpler way to represent all information than just using 2 markings? If you can, you may win a Nobel or Turing Prize. If not, then it shouldn’t be too controversial to say that binary notation is the best notation for storing information.

                      Likewise, can you improve upon tree notation? Can you come up with a simpler way to represent all abstractions than just using horizontal and vertical spacing? I can’t, have been trying for 7 years, and at this point have code that turns more than 10,000 different languages into Tree Notation, covering hundreds of languages concepts. If you can figure out something better, please, please, share it with me so I can move on to other things and you may win a Nobel or Turing Prize.

                      This is so incredibly off-base it verges on delusion.

                      You are right! E pur si muove!

                      I don’t think anyone would want to use them

                      This is a great criticism, and my only answer is we are making progress! The Tree Language powering Ohayo is getting quite good, and could be the first killer language, in a few weeks to months. I did underestimate (by 10x+) the amount of infrastructure and data we needed to build before we had killer-app Tree Languages. It is not as simple as coming up with a set of words that compiles to the language of interest. That does not get you a great language. Even though the base of Tree Notation is so simple, you still need to think through dozens to hundreds of design decisions to make a great language. Luckily, we’re automating a ton of that through a huge data gathering and machine learning effort. More to show on that front in 6 - 9 months.

                      it’s not possible to generalise the creation of usefully distinguishable VMs.

                      This is a good insight. However, we can indeed make the building of “usefully distinguishable VMs” 10x easier through both the rules of the language itself coupled with a huge dataset of languages, machines, and patterns.

                      There are no actual evils in your three options,

                      Yes, there are.

                      1. If I tell no one, people die, diseases remain harder to cure, and a whole host of other problems remain more difficult because we are wasting incredible amounts of time and energy using suboptimal tools.
                      2. If I tell people but say “this only applies to some small domain”, not only am I going against my code of being honest, but we miss out on the huge network affects that come from people utilizing the universality of Tree Notation, leading again to problem #1 above.
                      3. Personally it’s not fun to invest so much of my time and resources into this, but there’s nothing I can do more that would have a more positive impact on the world than this. Until other people “get it”, and the community grows, I feel a responsibility to keep pushing the ball forward.

                      the third will certainly lead to people ignoring you.

                      People ignore Tree Notation (and me) no matter what. I’m not worried about the majority of people. They’ve got their own lives to worry about. My strategy is to reach people who understand “exponential thinking”. If there’s a 1% chance I’m right, and let’s say software productivity goes up 30% in 10 years. We are talking about an annual value in the trillions. Even at 99% odds of me being wrong this is a many-billion-dollars idea in expected value for the world.

                      1. 5

                        One negative side-effect you may be missing is that people might ignore you and tree notation who would otherwise be interested. E.g. I’m curious about the word “bern” in your example – does that have meaning? But I’m guarded against engaging and asking because I’m worried I’ll have a crazy person following me around and not going away.

                        1. 3

                          I’m curious about the word “bern” in your example – does that have meaning?

                          It’s a placeholder for that keyword that I added a long time ago and haven’t revisited. At the time I couldn’t think of a word for “content” that wasn’t so generic and so went with a unique word that will be easy to find/replace later. Looking at it now my first though was a reference to Bernie Sanders, but then looking back I realized it was a nod to Tim Berners-Lee, which makes more sense. Anyway, I added a todo to the Grammar file for Stump with a clarification there.

                          But I’m guarded against engaging and asking because I’m worried I’ll have a crazy person following me around and not going away.

                          Haha this made me laugh out loud. (And then cry a little bit inside.)

                          It is true though. I strive to be a good scientist. Marketing and community organizing are not my thing. I often jump on the chance to have a conversation about an exponential phenomenon which online can come across as crazy (in person I can quickly assess if someone wants to talk exponential or the more calm here and now). The best decision I made at my last startup was removing myself from the CEO role and recruiting a guy to take over the business and marketing so I could just focus on the code and science. With the Tree Notation Lab I started, I hope to do the same–find a good manager and a good community organizer to lead the “people” efforts so I can focus on the science.

                    2. 6

                      You cannot improve upon it, and in trying to improve upon HTML/XML/Lisp/any other language people will keep reducing until they reach Tree Notation.

                      There have been many proposals over the years for “improving” upon s-expression notation for Scheme and Lisp, including indentation-based “tree notation”. This has never caught on. In the Ruby/Rails scene there has been HAML for a long time, which is basically this notation. That never really became massively embraced by the Rails community either. Sass did catch on massively, even outside the Ruby community, but only after it grew a more traditional CSS-like syntax.

                      Given this history, I have no reason to believe yet another indentation-based notation for HTML is going to change the world.

                      Besides, there are downsides to indentation-based notation for communication. I experience this several times a week when I try to copy/paste some Python code and the indentation gets lost in translation. At least with s-expressions the layout may be messy, but it’ll still work when you copy and paste stuff.

                      1. 2

                        There have been many proposals over the years for “improving” upon s-expression notation for Scheme and Lisp, including indentation-based “tree notation”

                        I currently track 38 of these, which is a shockingly small number of languages (~99% of languages are not indentation-based). The one closest to Tree Notation is I-Expressions, created in 2003 by Egil Möller. It has not gained traction, yet.

                        The difference between Tree Notation and these, like HAML/SASS/etc, are network effects. Currently if I write a tool for editing HTML, it only helps HTML authors. But if I write a tool for editing a Tree Language that targets HTML, it also helps people using Tree Notation to target assembly, C++ , TypeScript, Java, et cetera.

                        Most of my time goes into work on some new very high level Tree languages. All of the syntax highlighting, autocomplete, error suggestions, etc, that are now present in this Stump HTML language, weren’t built for that at all. That’s why these indentation languages will be different than the 38 that have come before.

                        1. 3

                          I’d be very interested in the references you mention, do you have a document somewhere that lists them?

                          1. 2

                            I don’t have it online yet (I’m slowly getting around to open sourcing my programming language database), but here they are as CSV:

                            id,wikipedia,appeared,website,reference
                            abc,ABC_(programming_language),1980,,
                            aldor,Aldor,1990,http://www.aldor.org,
                            boo,Boo_(programming_language),2003,https://github.com/boo-lang,
                            buddyscript,BuddyScript,2002,,
                            cobra,Cobra_(programming_language),2006,http://cobra-language.com/,
                            coffeescript,CoffeeScript,2009,http://coffeescript.org,
                            csl,,1966,,https://doi.org/10.1093/comjnl/5.3.194
                            curry,Curry_(programming_language),1990,,
                            elixir,Elixir_(programming_language),2011,https://elixir-lang.org,
                            f-sharp,F_Sharp_(programming_language),2005,http://fsharp.org,https://docs.microsoft.com/en-us/dotnet/fsharp/language-reference/index
                            genie,Genie_(programming_language),2008,,
                            haml,Haml,2006,http://haml.info/,
                            haskell,Haskell_(programming_language),1990,https://www.haskell.org,
                            i-expressions,,2003,,https://srfi.schemers.org/srfi-49/srfi-49.html
                            inform,Inform,1993,http://inform7.com/,
                            iswim,ISWIM,1966,,
                            literate-coffeescript,,2013,https://coffeescript.org/#literate,https://news.ycombinator.com/item?id=5277916
                            livescript,LiveScript,2011,,
                            madcap-vi,,1972,,https://semanticscholar.org/paper/edb9d7f3c18ad47f1c4879434a784a3d17dbea6f
                            madcap,,1960,,https://semanticscholar.org/paper/4bef4a1b67016e569ca7ef57bfc356829c2152ba
                            makefile,Makefile,1976,,
                            markdown,Markdown,2004,,
                            miranda,Miranda_(programming_language),1985,,
                            nemerle,Nemerle,2003,http://nemerle.org,
                            net-format,,2006,,https://genome.ucsc.edu/goldenPath/help/net.html
                            nim,Nim_(programming_language),2008,https://nim-lang.org/,
                            occam,Occam_(programming_language),1983,,
                            org,Org-mode,2003,https://orgmode.org/,https://orgmode.org/org.html#Document-structure
                            promal,PROMAL,1986,,
                            purescript,,2013,http://www.purescript.org/,
                            python,Python_(programming_language),1991,https://www.python.org/,https://www.programiz.com/python-programming/keyword-list
                            restructuredtext,ReStructuredText,2002,,http://docutils.sourceforge.net/rst.html
                            sass,Sass_(stylesheet_language),2006,http://sass-lang.com/,
                            scss,,2006,http://sass-lang.com/,https://en.wikipedia.org/wiki/Sass_(stylesheet_language)
                            spin,,2006,,https://learn.parallax.com/educators/teach/spin-programming-multicore-propeller
                            stylus,Stylus_(stylesheet_language),2010,http://stylus-lang.com/,
                            xl-programming-language,XL_(programming_language),2000,,
                            yaml,YAML,2001,http://www.yaml.org/spec/1.2/spec.html#Introduction,
                            
                            1. 3

                              There’s also wisp, which seems to be a separate project from sweet-expressions.

                              1. 3

                                Another nice catch! Thanks. Flipped that bit in my DB. Looking at this now, I’m realizing that my crawler/ML code was not pulling out indentation languages and that bit was only getting set manually over the years.

                              2. 3

                                This list is missing sweet-expressions aka SRFI 110 aka t-expressions, which is an evolution on i-expressions (be sure to read the design rationale, it has some criticism of i-expressions you might want to consider).

                                1. 1

                                  Good catch, thank you. I track Sweet Expressions but mistakenly omitted the hasSemanticIndentation? flag.

                                  I actually think Sweet Expressions were a regression on I-Expressions.

                    3. 2

                      Hakon doesn’t work correctly. Try setting border to value “1px solid red”.

                      I’m probably missing something, but this looks more like a proof of concept than a proof of an idea to me.

                      1. 1

                        I wrote this in Hakon:

                        .someClass
                         border 1px solid red
                        

                        It compiled to this:

                        .someClass {
                          border: 1px solid red;
                        }
                        

                        Is that incorrect?