Bondy - a new declarative language for the BEAM

Hi all,

On 21 October I will be at Code BEAM Europe in Haarlem presenting Saying What — A New Declarative Language for the BEAM. It is the first public introduction to Bondy, the language.

Some of you know Bondy as the WAMP router. That project continues as Bondy Connect and is getting its 1.0.0 release. The name Bondy now covers the brand and the language. The new website at bondy.io explains how the two fit together.

The language in one paragraph. Bondy is statically typed, functional, relational and rule-based.
It is self-hosted and targets the BEAM. The value model is the Shape, in the Typed Feature Structure tradition. The type system is semantic subtyping over that model: types denote sets of runtime values, and subsumption between Shapes, subtyping between types and membership of a value in a type are one relation, decided by one emptiness oracle at compile time and at runtime alike. Inference is Hindley–Milner on the equational fragment and bidirectional checking everywhere else, and principal types are claimed for that fragment only. Constraint solving is in the HM(X) style, over named constraint domains hosted by Constraint Handling Rules. Effects are capabilities carried in the arrow type, so purity, determinism and sandboxing are subtyping questions. The system is sound by default, and gradual typing is an explicit opt-in. On top sit typed relations with pluggable adapters (ETS, Postgres), derivation rules for deductive queries with provenance, rewrite rules for reactive logic, and GenReactor, an OTP behaviour for a process whose state is a set of constraints the runtime keeps consistent. You can also ignore all of that and write plain functional code, as you would in Erlang.

An early version runs in production with Leapsight clients. The first public release (Apache 2.0) will be announced during the talk.

The series. A conference slot is too short for the whole argument, so I am writing it down as ten essays under the same title, “Saying What”. They are the prequel and the sequel to the talk:

  1. Bondy as Consilience
  2. One noun, more roles
  3. The type that validates
  4. Rules that fire themselves
  5. The process that owns the store
  6. Ask questions of your data
  7. What a function is allowed to do
  8. The alarm that cleared itself
  9. The manifest is a module
  10. One module, five nouns

Questions and criticism are welcome in this thread. For longer discussions, the Bondy community is now on Zulip: https://bondy.zulipchat.com

8 Likes

Nice one Alejandro!

If you’d like us to set up a dedicated forum like we have for other BEAM languages let me know :023:

HI @AstonJ , yes that would be awesome! Thanks a lot.

1 Like

Ok.. done - good luck! :023:

Feel free to use it to post news, chat/discussions and questions etc. When posting news have a look at how the Erlang Core Team post news in the main Erlang News Sections for general guidance (include as much of the info as possible, etc) :icon_biggrin:

Note that the BEAM language forums will change when/if we move to a similar platform to the Elixir Forum (as the system there is better overall) but that’s for the future one day.

1 Like

Thanks a lot @AstonJ !!!

1 Like

This is very cool. “rule-based” is always interesting and I hope this goes down well.
Can’t be at Code BEAM so will have to look forward to the recording.

1 Like

Hi Peter,

We talked about Datalog before (your language was based on Datalog was it not?). So yes, Bondy embeds Datalog (the relational part) and of course that means we have deductive rules.

When I say rules here I mean Constraint Handling Rules (CHR) - so rewriting rules.
CHR is super powerful as a rules-based formalism and language that allows you to embed most other rule-based approaches: Production and Event-Condition-Action rules, even Datalog itself (not what we are doing).

We use CHR in bondy as the basis for reactivity and as a Constraint Solver. In fact the type solver is implemented in Bondy rules itself and it type-checks itself too.

2 Likes

This looks really awesome!

2 Likes

Thanks @asabil !!

1 Like

No datalog in EYG at the moment but I would like to add query literals back one day

1 Like

The Bondy GitHub repository and documentation website will be public soon. We’re doing some cleanup first. To clarify my earlier point: Bondy is open source under the Apache 2.0 license.

I’ll post here as soon as the repository is set up.

Also, although we use Bondy in production at Leapsight, the language is still experimental and you should treat it that way.