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?

3 Likes

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.

7 Likes

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.

14 Likes

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.

2 Likes

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.

2 Likes

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.

2 Likes

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)
end
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)
end

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.)

3 Likes

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.

4 Likes

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: