1. 84

  2. 35

    Describing Wren as “classy” because it has classes; and its VM implementation as “under 4,000 semicolons”; is cute, and earns it a +1.

    1. 9

      Hehe - gotta watch that semicolon budget 😎

      1. 1

        Maybe switch to Python if you run out…

        1. 2

          I use Clojure at work, and Emacs Lisp at home, so I’ve got semicolons to burn in my prose ;-)

      2. 2

        Careful, you just used two semicolons, or .05% of Wren’s total budget.

      3. 18

        I think it’s worth pointing out that Wren is made by the creator of crafting interpreters. Perhaps that’s a little bit of an argument to authority, but the author clearly knows a lot about creating languages.

        1. 4

          I’ve followed the second part (bytecode VM implementation) of this book in C++ and I can say that it’s been one of my favorite project-style book walkthroughs in a while so far! Good combination of learning low level things and also learning parsing stuff at the same time, in a very pragmatic way. I think the information is also very relevant to current-day systems, since they are often usually running such a VM somewhere or the other.

          edit (and maybe tangential): Godbolt link for what I’ve done so far: https://godbolt.org/z/5GbhnK I followed till control structures then did the nan-tagging bit and added ‘indirect threaded’ dispatch, it actually comes out to be competitive for arithmetic-loop benchmarks with other real (JIT-off) VMs (included times for benchmarks vs. Lua{,JIT}, v8, …). I’ve been interested in building out a VM that doesn’t (or rarely/differently) does GC (eg. if it’s just for a per-frame rule in an ECS-y game, it does some logic and calls system functions to save out data–so mgmt of layout and lifetimes of longer-term data is in the ECS in the native lang, or described elsehow (scene editor tool / ….)) and has easy interop with C struct type memory. SPIR-V is an interesting format in this space too (it’s cool that you literally define types upfront with eg. OpTypeVoid and OpTypeStruct then can do eg. OpAccessChain…).

          1. 3

            Nystrom is also one of the main guys behind Dart (and a good twitter follow to boot).

            1. 24

              I wouldn’t describe myself as one of the “main guys”. I was not one of the original language designers and only joined the language team as a full member much later. I’m just higher profile because I wrote more stuff down and use Reddit and Twitter more. :)

              1. 1

                Is there a chance of the printed book being under a Christmas tree in 2020? ;-)

                1. 2

                  I would love that to be the case, but it seems unlikely. I’m making steady progress on the last editing pass and the typesetting, but it’s a big project and 2020 is not exactly playing nice with anyone’s goals.

            2. 2

              I loved the second part, and it enabled me to write a small VM + “compiler” in rust for a proof language I’m working on, in a few thousands lines (although it uses fixed size instructions, à la lua, rather than pure stack instructions). I found the book very interesting and well written, kudos u/munificent !

            3. 4

              I love the fact that Wren’s claimed superior performance is explained in a honest (and interesting) manner : https://wren.io/performance.html

              1. 4

                Love it! I was looking for something embedded to create a rule-engine.

                1. 2

                  Smalltalk in a Lua-size package

                  And missing all of the smalltalk…?

                  1. 2

                    All of it.

                    I really enjoy the smalltalk syntax personally, finding the smalltalk image orientation just a little too much. Filesystems won.

                    But the smalltalk syntax might make a good platform for easy actor oriented code

                    1. 2

                      The point of smalltalk is to be able to point to anything in the environment and see/change the code live, see the result of changing the code live, etc

                      If this had similar syntax I could see the confusion. Maybe it has ruby-style live changing abilities? Otherwise I’m not sure how it’s smalltalk related at all…

                    2. 2

                      The same author has another earlier language called Finch which has smalltalk-like syntax:

                      // create an object and put it in a variable "dragon"
                      dragon <- [
                        // define a "trace:" method for outputting the series of left and
                        // right turns needed to draw a dragon curve.
                        trace: depth {
                          self traceDepth: depth turn: "R"
                          writeLine: "" // end the line
                        // the main recursive method
                        traceDepth: n turn: turn {
                          if: n > 0 then: {
                            self traceDepth: n - 1 turn: "R"
                            write: turn
                            self traceDepth: n - 1 turn: "L"
                      // now lets try it
                      dragon trace: 5
                    3. 2

                      I also enjoyed finding out about https://dotink.co/docs/overview/ these days.

                      Stories with similar links:

                      1. wren - a classy little scripting language via akalin 5 years ago | 34 points | 5 comments