
Barliman – real-time program synthesis to make the programmer's life easier - michaelsbradley
https://github.com/webyrd/Barliman
======
noway421
This is dangerous. Instead of acquiring understanding, a tool like this lets
the programmer just write the code which passes tests. Without the deep
understanding of algorithm you can't write sufficiently full tests which
assess program's correctness. TDD wouldn't save here, because instead of being
a tool of discipline it becomes a list of instructions for codegen.

Would anyone want to ride in a car or fly in a plane written by set of
sporadic tests? I wouldn't risk it.

~~~
cle
Of course nobody should write production software with this, that's why the
project loudly says that this is a PROTOTYPE. It is experimental software.

These kinds of tools are the future IMO. It's a higher layer of abstraction.
Most programmers have no idea how their programs are actually executed--we
write in a high-level language and rely on voodoo to execute it, without a
"deep understanding" of how it's really executed, and without writing
instruction-level tests. And it works _great_. I don't see how this is
theoretically different, it's just a higher level of abstraction. Of course,
its utility greatly depends on the practicality of its implementation (which
includes performance)...

> it becomes a list of instructions for codegen

That describes exactly the everyday programming languages that we all use.

~~~
noway421
You don't need understanding of all deeper levels, you just have to know the
system til the first non-leaky abstraction.

Concrete concepts are a good foundation of correct code, no matter how high
level they are.

------
yellowapple
I've felt for awhile that it's a matter of time before we end up with a
development environment that - given a collection of tests - will
automatically generate a program which passes all the tests. Barliman looks
like a really cool step in that direction, even with its stated limitations.

~~~
setr
isn't that called prolog

~~~
abecedarius
Prolog can (sometimes) "reverse execute" a specification, not generalize from
examples. It's like saying "a cat has a round face and pointy ears" versus
"look at these cat pictures". (Versus "draw an oval and then draw two
triangles at the top...")

~~~
mycl
But generalising from examples has been a research topic in the Prolog
community since at least the early 80s. The field is called inductive logic
programming
([https://en.wikipedia.org/wiki/Inductive_logic_programming](https://en.wikipedia.org/wiki/Inductive_logic_programming)).

------
gergoerdi
This seems like a real-time / on-line version of MagicHaskeller:
[http://nautilus.cs.miyazaki-u.ac.jp/~skata/MagicHaskeller.ht...](http://nautilus.cs.miyazaki-u.ac.jp/~skata/MagicHaskeller.html)

~~~
aetherspawn
This thing is so smart.

Add a 'z' to the end of the first example and it figures out it needs to
'reverse . drop 1 . reverse' to take a character off the end.

Imagine if it could learn on every open source Haskell codebase on GitHub and
then learn in real time while people type.

------
accurrent
This looks pretty awesome. Does anyone have good book/lecture/paper/course
that deals with program synthesis and the algorithms behind them.

~~~
zaph0d
Barliman is written in miniKanren[0], a logic/relational programming system
built by Daniel Friedman[1], Will Byrd[2] & Oleg Kiselyov[3]. There are
implementations of miniKanren in languages other than Scheme, one of the
prominent being Clojure[4].

To oversimplify, in the miniKanren world programs are written using relational
logic, wherein there are "variables" and then certain "relationships" between
the variables. That is the program specification. Now we can run the
specification and allow miniKanren to generate one or more variables that
satisfy the relations. Thus a miniKanren program can have more than one
answers. One interesting side-effect of this kind of an abstraction is that
programs can also be run backwards to generate more programs that satisfy
certain relations. That's pretty much what's happening with Barliman.

[0] [http://minikanren.org/](http://minikanren.org/) [1]
[https://en.wikipedia.org/wiki/Daniel_P._Friedman](https://en.wikipedia.org/wiki/Daniel_P._Friedman)
[2] [http://webyrd.net/](http://webyrd.net/) [3]
[http://okmij.org/ftp/](http://okmij.org/ftp/) [4]
[https://github.com/clojure/core.logic](https://github.com/clojure/core.logic)

~~~
neoncontrails
Some of you might recognize Daniel Friedman as the author of The Little
Schemer. If you liked that book, you might check out The Reasoned Schemer.
Short, accessible, and a bit mindbending, it offers a compelling introduction
to logic programming that culminates in the "invention" of a Prolog-like DSL
from basic Scheme primitives. Terrific little book.
[https://mitpress.mit.edu/books/reasoned-
schemer](https://mitpress.mit.edu/books/reasoned-schemer)

------
tluyben2
This combined with a robust type system should be nice. I thought it would be
a solid direction which would've happened but didn't. One of my uni courses
was ILP (long time ago indeed) and that seemed to have merit with faster
computers, more advanced algorithms and heuristics. After that I saw Hoogle
when I learned Haskell; seems combining these things can make something
powerful. I was going to post MagicHaskeller here as well but gergoerdi did
that already.

------
supermdguy
This looks pretty cool! However, I think it would be annoying to have the
tests automatically running as you're typing. What happens if you accidentally
create an infinite loop or run something dangerous?

~~~
etherealG
Stop at x time. What else is dangerous?

~~~
supermdguy
I was thinking of overwriting files or removing database items. I know it's
pretty easy to minimize, it just could be a problem if it isn't.

~~~
etherealG
Fair enough, indeed I would advise to use with caution around data that needs
to be kept safe from deletion. I think of this as a nice idea for
experimenting forms of coding like spikes, but wouldn’t run something like
this against a production database or my root file system.

------
noobiemcfoob
Attach a program that can evaluate and define test parameters... I'm looking
at a core of my replacement >.<

