1.  

    If Haskell is a niche language, then OCaml is a super-niche language

    It has certain popularity in Javascript ecosystem because of Bucklescript, but mostly in the form of ReasonML. Not sure, however, if it’s just a (smallish) hype; and Bucklescript originated from the same fintech niche that uses “regular” Ocaml.

    1.  

      Thanks! I passed the test and rewarded myself with a new guitar 😁

      1.  

        Yes! I have started reading the paper now and it’s almost exactly what I’ve been looking for in this area!

        1.  

          Learning Haskell via Advent of Code while still maintaining podium position on company leaderboard. Loving the problems up till now!

          1.  

            I remember investigating m4, I forgot why I didn’t use it, maybe I prefered the PHP way.

            1.  

              PHP was an inspiration for pp(1). :)

              1.  

                Yeah, I just automated the echos. Heredocs are slow overall.

                1.  

                  I’ve found a decent way to make static web page builders is to just use shell scripts that call cat with heredocs, like:

                  cat <<EOF
                  <!doctype html>
                  <meta charset=utf-8>
                  <title>foo</title>    
                  EOF
                  ./header
                  ./content
                  ./footer
                  echo "</html>"
                  

                  and stuff like that…

                  1.  

                    You might “hate” JSON because it’s overused in certain contexts, e.g. it’s not good for config files.

                    But there are many good uses of JSON too. Other observations:

                    • JSON fits very well with shell’s philosophy because it’s “versionless” and “polyglot”.
                    • Yaml and Toml both desugar to JSON. Oil will have support for a few other serialization formats, but not yaml or toml because you can just convert them to JSON with a separate tool, and then pipe that as JSON into Oil.

                    Oil will probably also have support for HTML and some kind of CSV/TSV. Those are also basically “versionless” formats, and they do jobs that plain text or JSON doesn’t do well.

                    1.  

                      I regularly recommend people to the OCaml object system. Not only is it decently nice (but underused because other parts of the language are more popular and cover most of what you might want) but it also challenges your ideas of what “OO” is in very credible and nice ways.

                      Classes are clearly separated from object types and interfaces. Inheritance clearly relates to classes as opposed to objects. Structural typing, which exists throughout the OCaml universe, makes clear what subtyping is offering (e.g., a more restricted sort of subsumption than structural classes will give you).

                      It’s just an alternate universe Object system which is entirely cogent, replicates most of the features you might expect, but does so with a sufficiently different spin that you can clearly see how the difference pieces interact. Highly recommended!

                      1.  

                        Thanks, this is great feedback!

                        • I plan to change pp to = for pretty-printing, and was overzealous in the doc :-/ I changed it back to pp for now.
                        • Added declare sharray=(...) as this works in both OSH and Oil. (Oil allows bare assignment like x = ‘foo’, so it disallows the old style x=foo).
                        • help builtin is future work, sorry about that! We made some progress on it in the 0.7.pre6 release.
                        • Yes in bin/osh, echo @array isn’t special. Because it’s meant to be strictly compatible with bash/POSIX, where you don’t need to quote @. This syntax occurs in a few command line tools so I don’t want to break them. When you opt into Oil you will have to writed '@quoted' for a literal @.

                        http://www.oilshell.org/preview/doc/json.html

                        https://github.com/oilshell/oil/commit/7ef11b82c9b7dd1703b8223004b85960600d06af


                        And I also realize the shell sessions on this page should be syntax highlighted! I’m planning that but would rather get some docs out first.

                        1.  

                          Or even more, Standard ML, which comes with a spec and not a reference implementation.

                          1.  

                            You can also use m4; e.g. https://github.com/vkitchen/apostl

                            1.  

                              Mixing the HTML with code resembles good old PHP :-) It is quite good for certain use cases. Sometimes I still use PHP this way (however I prefer languages like Java for not so small projects). Also old (pre-XML) JSP worked similarly.

                              I did some websites with XSLT+Make, so I know how powerful and simple this approach is.

                              1.  

                                Just want to point out that it’s unlikely any user-level code on the browser will replace normal application rendering stacks, either using WASM or JS. If the UI elements on the page are opaque to the browser, then screen-readers and other accessibility features won’t function. That’s just the tip of the iceberg, you’d also have to re-implement IME for your international users.

                                1.  

                                  Have a look at the $-family of recognizers, starting from the $1 unistroke recognizer. The others build from there. They’re all designed to be simple and easy to implement with no ML required.

                                  1.  

                                    Page 22 of their paper describes the data sets they consider. Eyeballing it, about half are from the social sciences.

                                    1.  

                                      I think richer objects than “a big string” are good and useful.

                                      JSON is a pretty poor format (no comments, can’t encode float values NaN, Inf or -Inf, expensive parsing, verbose, etc), but it is also quite popular and basically good enough for most purposes.

                                      1.  

                                        For other readers: the linked blog post in SteveH’s comment is by one of the authors of the paper and highlights several key takeaways. Recommended!

                                        1.  

                                          A few of us wrote a small zsh prompt called geometry that centers a bit around this idea. You define two arrays, one for left prompt, one for right prompt. The right prompt functions are all called and updated async, left prompt sync. We ship a decent amount of functions that are defined but not enabled. Kinda looks like this:

                                          function slowhi() { sleep 7 && echo 'hi!' }
                                          GEOMETRY_PROMPT=(geometry_status geometry_path)
                                          GEOMETRY_RPROMPT+=(pwd slowhi)