1. 32

What are you using your programming language innovation tokens on? Is there a syntax or a standard library feature, or is it just for performance?

(The criteria for a “small” language is one you couldn’t easily find a job for)

  1.  

  2. 16

    I am a big fan of Janet, which I find pretty cool to use and manipulate.

    Two features come out as strikingly useful to me, on top of the language being compiled.

    • The very simple to use and very efficient PEG in the standard library
    • The DEAD EASY C interop, which makes using C features or libraries a dream.

    I use this language at work to parse logs, automate some tasks, and I also use it on my personal blog and services for Gemini/text parsing (e.g. to HTML).

    1. 7

      Janet is also the “small language” I’ve been using recently, to build a self-hosted tag-oriented CMS for organizing my photos and videos and such. I’m happy with its standard library support for SQLite3 & PEG, the latter of which I have been using to implement the query parser (i.e. turn “give me files tagged with A and B but not C” into SQL).

      I’ll probably write about it when I’m done with it. I like Janet, but I don’t know if it will become my language of choice. I still very much like good ol’ Scheme (which is probably a bit smaller than Janet).

      1. 1

        Honestly, that depends on how much of the Scheme standard is implemented by the Scheme. IIRC, the later ones were pretty large, no?

        1. 2

          R6RS is “large” relative to R5RS/R7RS. I wouldn’t call it “large” relative to other programming languages. R6RS is probable comparable to the Janet stdlib.

      2. 2

        on top of the language being compiled

        I’m curious as to what you mean by this. Isn’t this true of nearly every language?

        1. 5

          Janet makes a building an executable out of your scripts a first class experience, as opposed to the second or third class experience it is in Ruby or Python. (I don’t know where fennel sites here, beyond Love2Ds bundling tricks).

          If I had to guess, that’s what is being referred to here.

          1. 2

            I see; so specifically the fact that the compilation output is bundled up into a single binary file then? (Fennel has a --compile-binary command which does this, since you asked.)

            1. 2

              Sort of. jpm can build an executable if you declare one in your project.janet. of your code and libraries are pure Janet, then you only have to specify the Janet file that acts as the entry point.

              But Janet doesn’t have to be compiled that way, it can run as a REPL, and/or as an interpreter. I’m sure you’re probably familiar with that level of flexibility of output.

      3. 14

        I am writing the wayland compositor I wish already existed in Zig. It is the only language I’ve found that I find beneficial to use for the task over C.

        Downsides of Zig compared to C include an immature ecosystem and a not-yet-stable language. Benefits include a much more powerful type system, elimination of the need for a preprocessor, and nice modern language features that I miss in C like sum types, optional types instead of null pointers, and proper namespaces.

        Even with all these niceties, I don’t feel like Zig is significantly more complex than C. This compositor is my first ever project in Zig and I learned the basics of the language in the first couple days/weeks working on it.

        Repository here if you want to check it out. I’ve been daily driving it for about 6 months now, the only thing holding back an 0.1.0 release are some widely breaking changes I haven’t had time to finish yet.

        1. 5

          For me, Zig is the most interesting C alternative in the (many) options being developed right now. I think it strikes a nice balance between simplicity, speed and safety. As a Lua fan, I think Zig could be a perfect companion to implement those libraries that need native speed, instead of C. Haven’t tried it yet in that context, but I feel like it could be a great match.

        2. 13

          I’ve got a structural text editor I’m working on in Fennel: https://git.sr.ht/~technomancy/anarres

          Right now I have a UI in love2d and an ed-type line editor UI. I think my next step is to expand the love2d one to be less textual and use actual graphical elements to draw each element of the AST.

          1. 11

            I’ve settled on Nim as my language of choice for personal projects. (It was a shootout with Rust, but the latter had too many inexplicable error messages and IMHO is too wordy.)

            • Literally compiles to C, so it’s fast and portable and bridges easily.
            • Generally pleasant syntax. Overloading in functions and operators, plus universal fn call syntax, makes for nice APIs.
            • Lets me do low level gunk without as much hassle as Rust, while keeping my high level code safe.
            • Community is friendly and not too huge.
            1. 11

              I’m writing a lot of Lua, which I love for packing so much power in such a small number of “features”, I find it very elegant and even relaxing to work with and it is usually “fast enough” for my uses. I’m writing what I describe as a “minimalist web systems framework” with it called tulip and building a website (kind of a niche search engine) with it in parallel.

              1. 6

                Love Lua! It’s such a pleasure to write — especially now that I’ve taken to converting every line of Vimscript (ugh!) to Lua, in my Neovim configs. It’s surprisingly easy to pick up, and really quite elegant.

                1. 5

                  Lua is fun. I used it at Apple in Safari’s RSS reader feature [RIP], for a simple HTML templating engine.

                  One might actually be able to get a job coding in Lua, in game dev…

                  1. 4

                    I too, am using Lua. I used it to implement my own gopher server and Gemini server.

                    I do use Lua for work, although I was not hired because of that. There, I use Lua for testing and for processing SIP messages.

                    1. 3

                      tulip looks awesome. I love Lua, and I have been wondering if anyone had used lua-http for server-side framework. I’ve only used it for building clients.

                      1. 2

                        Thanks! Yeah lua-http (and cqueues + luapgsql, the core foundation I use) are great libraries. Works great so far, though it is a young project. That’s (part of) the goal of my parallel project to dogfood/stress-test it and figure out some shortcomings.

                    2. 9

                      OCaml is arguably small (it’s definitely not easy to find a job for it), but I’ve been using it for web development, hardware development, and even to play around some graph algebra. I love ML in general, but I am particularly fond of OCaml for the above-average quality of the ecosystem (and PPX extensions!).

                      1. 9

                        I’ve used two specialized languages for digital signal processing/audio programming:

                        Faust is an older language developed in academia and supports a functional design and support for a huge variety of platforms from microcontrollers to the web browser via WebAudio + WebAssembly

                        Soul is a new language that just hit 1.0 a couple of weeks ago. It is a fresh take on the same problem space, but it has a simpler syntax and seems targeted at devs that are familiar with C++ or Java.

                        Both have real advantages for doing audio programming and have active communities with a lot of open source code available to build on top of.

                        Since both support compiling to WebAssembly, I’ve added a code editor to the experimental browser-based audio synthesis platform[1] I’m building to dynamically compile code in either one of these languages to WebAssembly on the fly and then load the compiled module into the WebAudio graph.

                        The fact that both languages are pretty simple with a tiny toolchain and specialized domain makes this dynamic compilation simple and effective. It’s a great way to prototype audio effects quickly without having to spin up a ton of boilerplate or project setup.

                        [1] https://github.com/ameobea/web-synth

                        1. 9

                          Janet is my current “small” language. I’m actively trying to work to make the ecosystem in Janet better (I’m hardly alone there, the gitter is a nice place to hang out).

                          I tried out Janet for Advent of Code, fell in love with its PEG library (it’s the first time PEGs have made sense to me). Then, I really liked the fact that Janet has a REPL-based doc function, which is something I had wanted for PISC. Then, I found out that Janet makes building your scripts into an executable very easy (which, as a windows user, is something I like a lot, and does an end run around the difficulties of deploying Python or Erlang).

                          Since then, I’ve been enjoying the Janet gitter/matrix room a lot, and I’ve liked the language enough to want to help it work better on Windows. I’ve also been trying to write libraries for some of the edges I’ve found in it, and I’m using it to build a couple of side projects related to Personal Information Management. I really think @bakpakin got it 95% right.

                          1. 5

                            In awk (and some Plan 9 rc), I’m writing a simple markup language that compiles to HTML: em.git

                            1. 4

                              (Not my language; one I’m contributing some small things to:)

                              “Small” language because:

                              • no modifiers
                              • no exceptions
                              • no null pointers
                              • no implicit imports
                              • no static members
                              • no collection literals
                              • no implicit conversions
                              • no method overloading

                              More on not repeating existing mistakes:

                              • <> for generics is wrong and broken, therefore use []
                              • Type ident works poorly with generics, therefore use ident: Type
                              • fields + methods + properties failed, instead avoid leaking method/field implementation details to callers

                              Pretty much the only thing I plan to spend language on is merging if-statements, pattern matching and the ternary operator into unified condition syntax.

                              That let’s me get rid of three moderately complex features in favor of one that is only slightly more complex (but vastly less complex than the sum of the complexity of all three).

                              1. 9

                                I don’t think you mentioned the name of the language :)

                                1. 4

                                  Likely

                                  https://github.com/dinfuehr/dora

                                  Clicked on some links and that’s something this user has contributed to recently on Github.

                                2. 1

                                  I totally agree on your syntax points.

                                  What are your thoughts on the fields + methods + properties … solutions?

                                  1. 1

                                    Basically there are two ways to “pay” for data: storage or computation.

                                    So you only ever need two ways to express them, i. e. let and fun.

                                    The core idea is that (unlike in C) let and fun already disambiguate these possibilities way better than an () after the name – so get rid of that.

                                    Consider this:

                                    class Person(let name: String)
                                        fun firstName: String = name.split(" ").get(0)
                                        fun lastName: String = name.split(" ").get(1)
                                    

                                    One field, two methods. Used like this:

                                    somePerson.name
                                    somePerson.firstName
                                    somePerson.lastName
                                    

                                    Imagine some time later the class gets refactored to this:

                                    class Person(let firstName: String, let lastName: String)
                                        fun fullName: String = firstName + " " + lastName
                                    

                                    … and the callers don’t need to change at all!

                                  2. 1

                                    That’s very cool! Do you have any thoughts on a unified function syntax? i.e., in most languages you can say f(x) = x + 5, or you can say f = x -> x + 5… function and lambda syntax are inconsistent!

                                    1. 1

                                      Yes: I would love to make it consistent, but I currently see no solution to that.

                                  3. 4

                                    I’d like to work on Prolog for some stuff. For me, it’s a language that is very concise and I feel very confident about the code I make that it is correct even if I write fewer tests. It is not perfect, there are sometimes performance issues, lack of tooling, so for anything serious, I will probably not choose it. My last public work with Prolog is an HTTP Server for Scryer Prolog. It still needs more work but it is already there if you want to try it. Some months ago I also shipped an HTML5 game with some parts written in Tau Prolog.

                                    1. 1

                                      What is your experience with Prolog? Do you use any of the advanced CLP features in some of the Prologs?

                                    2. 4

                                      J is a small language. I want to write small programs from time to time, to simply flex my mind in a different direction

                                      1. 3

                                        I’ve been rewriting my static site generator in Posix shell and AWK. I don’t plan on getting hired for either of those skills anytime soon XD

                                        1. 3

                                          Is Raku small? I’m asking because if I’m being pedantic, Raku is not Perl. I’m writing a text based RSS aggregator in Raku, but mainly for learning (I never learned Perl properly either).

                                          1. 2

                                            Is Raku small?

                                            Raku is probably one of the largest language’s I’ve encountered, on a par with c++ or common lisp.

                                            1. 3

                                              Or one of the smallest at the core :)

                                              Besides, yes Raku make it seems it covers a lot of ground but due to the uniform approach syntax, you can easily understand what’s happening. Raku keeps giving me a Scheme/Racket-like feel each time I wrap my head around something and realize how much I can compose with every element.

                                              1. 1

                                                FYI, small doesn’t mean language surface area. From the OP:

                                                (The criteria for a “small” language is one you couldn’t easily find a job for)

                                                It confused me as well.

                                            2. 3

                                              I am currently porting my algotrading program from Python to Nim for three reasons.

                                              • It’s faster that Python
                                              • It’s compiles into a crossplatform, single executable binary — deployment is basically uploading a single tiny executable file. No “virtualenv” , containers or other uncessantly complications
                                              • Nim still has the ergonomics of Python (which was why I used it in the first place. So I don’t feel like I am missing out on anything
                                              1. 3

                                                I’m at the first step of using 6502 assembly to write a Gopher client for the Apple II. I would say that the main feature is performance ;)

                                                1. 2

                                                  I like writing small languages or VMs for the purpose of demonstration. Maybe to demonstrate how to write a bytecode compiler, or add inline caching, or do bytecode rewriting, …

                                                  Aside from that, not much. These days I tend to write my DSLs embedded in Python :(

                                                  1. 2

                                                    I’m using OCaml for synsh.dev, which generates shell pipelines from examples of the input to the pipeline and expected output. I picked it primarily because it targets both native binaries and JavaScript, because it provides straightforward support for asynchronous execution (through Lwt), and because I have a lot of prior familiarity with it.

                                                    1. 1

                                                      I have written and maintain a number of command line server admin/developer type tools (and wrote and maintain a library, to make it easier to write and distribute said tools) in posix shell.

                                                      Shell is obviously quite common in ops roles, but I don’t know many jobs are hiring specifically to write shell?

                                                      1. 1

                                                        To answer your question, my biggest win for a creating an internal DSL in Python was to help QA and business analysts construct test cases for a financial rules engine.

                                                        When the rules engine was rewritten in Java, I was able to write a compiler in Java so we could port the existing tests to the new system. There was some Jython in the mix as a way to test the tests, but that was only done during the development of the port.

                                                        I find little languages have two really powerful uses

                                                        • Providing a minimal interface for a narrow use case to domain experts
                                                        • Achieving semantic clarity for things that would be hard to express in the host language

                                                        The second one is where you can have some larger multiplier in productivity by making opaque hard to reason about code seem playful. Logic, constraint, probabilistic and differentiable programming come to mind.

                                                        1. 1

                                                          I had been using LDPL for a little while on toy projects, one such project was porting a simple BASIC game to LDPL https://github.com/photogabble/ldpl-space-mines

                                                          1. 1

                                                            Coincidentally, just like @acdw, I recently wrote the most bare-bones of static site generators, in POSIX sh; it’s in this gitea repo. I’m using it now to render static pages for my tilde.team webspace.

                                                            It’s barely more than a wrapper around cmark (the CommonMark reference implementation) right now, but it was good practice with sh nonetheless. It also gave me an reason to learn some basic sed and awk. I’d never touched those before, and I think I understand what makes them useful better now.

                                                            I haven’t touched it for a while, but I hope to go back to it some time not so far in the future and touch it up. Maybe one day it’ll be a full static site generator! Will it still be written in sh? Who knows! (But perhaps for my own sanity I should change languages before I make it bigger…)

                                                            1. 1

                                                              It’s good to see a fellow member of tilde.team in the wild. :)