REBL: Has anyone seen this?

After watching this talk from Stuart Halloway, I wonder how cool would it be to implement the general idea with Elixir. :slight_smile:

1 Like

Could you add more info please @imetallica ? What is ‘REBL’? Any other sites/resources you could link to with further info?


Just watch the talk…

As it so happens, I have a TL;DW for it.

TL;DW, In Clojure, new protocol datafy (make this thing data) + new protocol nav (go somewhere) + allowing protocols to be implemented on instances of data as metadata permit what they call REBL which is “Read Eval Browse Loop”, to be able to browse in a consistent, lazy manner across things like Clojure data, and java class info, and namespaces, and web pages, and info in Datomic, etc.

Several people have likened it to smalltalk’s interactive dev environment.


Not everyone has the time to sit down and watch half an hour of a random talk that has nothing been said about.

Therefore its always nice to provide a short description about the talk itself.


Thank you such a thing always helps!

Sounds a bit like the “go to definition” of my editor in the REPL… Nothing I’d miss in iex, but maybe some kind of necessary in a language that is said to be such slow to compile that one actually does only use the REPL for coding and at the end of the day somehow saves that into a file… As far as I remember this was “clojure”… Oh, I just see, this is about clojure…

I never did smalltalk, but perhaps I’ll put it on my list some day or the other.


I do think that if you want to dismiss the idea you should probably watch the video, because it’s probably not productive to base your sentiments on a gross simplification (which is what my TL;DW is).

The driving concern behind REBL is one of being able to provide generic tooling that allows a developer to dig into disparate and not necessarily predefined data from any number of sources in a potentially lazy fashion, and I think that’s something that should at least pique the interest of any functional programmer who works with large complicated data sets.

For example, one could imagine using something similar to build generic tooling to simply walk through and dig into the result sets of paginated Ecto queries during development, fetching the next page automatically when you move into it.

Whether or not the idea has any place in Elixir it is interesting, and their solution is pretty elegant and well worth watching to video for.


Do you have a transcript or some bloggified form for me? Maybe even some interview in a podcast would work, as those are easily consumable during commute, either by TTS or simpe audio.

Its hard to find some time to actually watch a video, as those is usually only possible on my workstation at home.


I don’t know of any, sorry. The talk was only recently given.

I don’t think a readable 1:1 transcription will help very much because there are some great visual examples in the talk.

But let me try to write down a summary of the talk:

As far as I’ve understood it so far(updating as I continue watching the talk), Closure 1.10 and up has two new protocols (akin Elixir protocols):

  1. Datafy can turn something that implements it into a readable (REPL-inspectable) format.
  2. Nav can be used to go from one piece of ‘something’ to another.

Together, this allows you to e.g. browse an insanely large or infinite collection at your own leisure. Or expand only the subnodes of trees that you want to look at in the REPL, etc. It basically gives you a much more sophisticated control mechanism of how you interact with results than simple settings like Elixir’s Inspect.Opts can.

Of course, you do need to create a tool that interacts with these protocols, but there can be many such tools, both command-line ones and graphical ones. In the talk, these tools are called REBLs.

The talk then goes on to show that a REBL tool could:

  • look at a collection as a spreadsheet table.
  • expanding any item of a collection to look at it in more detail.
  • look at a numerical collection as a graph.
  • look at code as the AST in data format.
  • look at code as highlighted source code.
  • look at an exception as data
  • look at an exception’s stack trace and expand any of the stack trace lines, looking at those in more detail.
  • look at a (potentially infinite) recursive datastructure, such as representations of the files/directories on your computer.
  • look at a Clojure class and see it’s methods, superclasses, documentation, etc.
  • browse a database query’s responses, pulling them live from the database.
  • follow foreign keys in the database responses to query other parts from the database.

And then, at any point you might take any of this data, and read it in as a variable into your REPL, so you can continue working with it in your code snippets.

Clojure implementation of Datafy and Nav in Elixir-terms:

defprotocol Datafy do
  @doc """Returns your_thing, but then as flat data!"""
  def datafy(your_thing)
defprotocol Navigable do
  @doc """
    Returns a (possibly transformed) version of `value` ,
    based on `collection` and `key` (a key/index or `nil`). Defaulting to `value` itself.
  def nav(collection, key, value)

The REBL-system in Clojure also uses something called ‘metadata’ which is something you can store ‘with’ your main data but is only used by things that look for it, rather than altering the identity of your data. (I am not entirely sure why this is used/useful and what analogous system we might use in Elixir for this.)


Good summary.

I could be wrong, but I think that the point of datafy isn’t to turn something into a REPL-inspectable format, it’s to turn something opaque-ish (like a Java class) to less opaque, plain ol’ Clojure data (ie. maps and vectors) that can then be used by a some other thing in Clojure, which could potentially be a renderer.


Gif’s or webm or so, as long as sound is not required is the hugely important bit if anyone makes a webpage about such things. :slight_smile:

That definitely is a better way to put it! :heart: