Vultaire's Blog

“Line-oriented JSON”: Using JSON for quick-and-dirty protocols and REPLs

As a Python and JavaScript programmer, I love JSON. Both languages support JSON really well, and it generally is more terse than XML while also providing basic built-in types. It’s very easy to rely on JSON as a general-purpose serialization format which can cross between both languages with a minimum of effort.

As such, one time I decided to use JSON for controlling a program via a read-eval-print loop (REPL). Rather than creating my own parsing scheme, it made sense to try to do things using JSON. Indeed, it is relatively easy to use JSON to do remote procedure calls, as is proven by existance of the JSON-RPC specification. (However, this post is not about JSON-RPC, nor do I use that particular protocol in this post, although similarities undoubtedly exist.)

As an example, here’s what a JSON-encoded remote function call might look like:

    "fn": "hello_person",
    "args": ["Steve"]

This can trivially be converted to JS or Python on the receiving side:


Now, the one key weakness I see with protocols based upon JSON is: what happens when an invalid JSON object is sent?


Re-evaluating my editor of choice: The first batch of editors

In my previous post, I made this list of programming-oriented text editors I wanted to take a good look at:

  • Emacs
  • vim/gvim
  • PyCharm (Community Edition)
  • Eclipse
  • NetBeans
  • Visual Studio Code

Since then, I’ve made a few minor additions:

  • IntelliJ IDEA (Community Edition)
  • Atom
  • Leo (maybe)

I’ve had a chance to take a look at a few of these. And while personal time constraints have reduced my ability to rate editors in the way I originally planned, I’ll at least provide what details and opinions I can.

So, without further ado…


Installing Lisp Flavored Erlang on Windows

As another Erlang experiment (and as a Lisp fan), I figured I would try to give Lisp Flavored Erlang (LFE) a try. However, per my normal requirements for learning new programming languages, I had to establish that it would not only work on Linux, but also on Windows.

I searched StackOverflow and found this post which indicates at least one other person has tried to get this working, however that person was not able to do so. Attempts to find other posts on the subject on Stack Overflow met with failure.

This was a little discouraging, but the post in question was over 5 years old, so I figured I would give it a try using MSYS2 and Mingw-w64.

The good news is this: I seem to have successfully built and got LFE running on Windows. I can’t say I can get it working in the exact same method as for Linux, and not without some tweaks to the scripts provided, but nonetheless, it is possible. It’s not even really that hard. In this post I will detail how.