Dev Diary (March 2017) - v0.3 alpha pre-release

Corey Montella - 06 Apr 2017

(Eve is a new programming language, and this is our development blog. If you’re new to Eve, start here)

Last month we updated you with some changes happening to the Eve runtime, including the addition of a Javascript DSL. Today we’re happy to announce a pre-release version of Eve v0.3 alpha. This “pre-release” is meant for members of the Eve community to preview the features of v0.3 before it’s ready for a broader audience (for example, docs, guides, and tools like the editor still need more work). We think you’ll appreciate some of the new features, so let’s take a look at what is new!

Platform

The big news today is that the runtime refactor we began earlier this year is capable of running full Eve programs. It still needs a lot of usability, documentation, and tooling work before it’s ready for an official release; nonetheless, this runtime already accomplishes many of the objectives identified earlier this year, like improving Eve’s extensibility. So we’re moving the runtime-refactor branch over to master, and making this version more accessible to the community. We’ll continue to work on this branch and release a more complete v0.3 later this year.

To get the pre-release you have a couple of options:

  1. Download the npm package with npm install witheve@preview
  2. Clone the eve-starter repository:
git clone [email protected]:witheve/eve-starter.git
cd eve-starter
npm install

The eve-starter repository is new, and demonstrates how a project can use Eve as a dependency. Whereas the v0.2 example programs were bundled with the Eve runtime, these example programs have no special privilege. Feel free to use this as a starting point for your own Eve project.

Here’s what’s new in the v0.3 pre-release.

Javascript DSL

We’ve talked a little about this before, but Eve now has a Javascript DSL. Right now, this is the only interface to the v0.3 runtime (the Eve syntax will be coming with the official release). The DSL has the same semantics as the Eve syntax, and even closely mirrors its form as well. Here is a translation guide between the Eve syntax and the DSL:

Basics

- find a record: find("person", {salary}) <-> search [#person salary]
- bind/commit:   return[record("person", {salary})] <-> bind [#person salary]
- functions:     lib.math.sin(number) <-> sin[degrees: number]
- aggregates:    gather(person).per(person.dept).count() <-> count[given: person, per: person.dept]

Sub-Blocks

- not:    not(() => person.salary) <-> not(person.salary)
- choose: choose(() => { person.salary; return 1; }, () => 0) <-> if person.salary then 1 else 0
- union:  union(() => person.salary, () => person.wage) <-> if person.salary then person.salary if person.wage then person.wage

Update Operators

- Add a value:         person.add("salary", 10) <-> person.salary += 10
- Remove a value:      person.remove("salary, 10) <-> person.salary -= 10
- Set a value:         person.remove("salary").add("salary", 10) <-> person.salary := 10
- Remove an attribute: person.remove("salary") <-> person.salary := none
- Remove a record:     person.remove() <-> person := none

Again, docs are sparse at the moment, but we’ve put together a basic guide for the DSL, which should get you started.

Importing/Exporting Data

One of the most common requests after the v0.2 release of Eve was “How do I get my data into Eve?”. People wanted to use Eve to work with data they already had, but at the time Eve was intentionally siloed from the rest of the world. Now working with external data is much easier thanks to the DSL; if you can get your data into Javascript, you can get it into Eve.

Importing Data into Eve

Getting data into Eve is accomplished with the inputEAVs() interface, which allows you to insert a raw entity, attribute, value triple into the Eve database. EAVs are the core dataype in Eve, and define everything from clicks to your application interface. Combined with the appendAsEAVS() function, which turns an object into an array of EAVs, you can now turn regular Javascript objects into Eve records.

Exporting Data from Eve

The opposite is true as well – you can turn Eve records into Javascript objects. This is accomplished through a watcher block. These operate as normal bind blocks, except they allow you to use a callback function to respond to changes in records (diffs). This allows you the opportunity to react to those changes using native Javascript functions and libraries. Here is an example watcher that calls out to a function external to Eve every time an #email/send record is created.

program
 .watch("Send emails", ({find, record}) => {
    let email = find("email/send");
    return [
     record({to: email.to, from: email.from, subject: email.subject, body: email.body})
    ];
 })
 .asObjects<{to:string, from:string, subject:string, body:string}>((diff) => {
    for(let email of diff.adds) {
     let {to, from, subject, body} = email;
     sendAnEmail(to, from, subject, body);
    }
 });

As part of our documentation efforts, we’re going to be posting a series of short, to-the-point examples demonstrating how to connect to common sources of data (csv, APIs maybe even a serial port), so users can get started working with their data. Please let us know on the mailing list which data sources most interest you. Also, if you get any examples working yourself, be sure to let us know as well.

Community

Contributions

Thanks to everyone who contributed pull requests last month!

Eve Around the World

Berkeley, March 17

Chris gave a talk at UC Berkeley’s BiD Lab about how programming language design could learn a thing or two from video games like Minecraft and Zelda: Breath of the Wild. Unfortunately, his talk wasn’t recorded, but we’ll release it in blog form later this month for anyone who couldn’t attend.

San Francisco, March 25

Last month Andrey Fedorov of the 20/20 Salon was kind enough to invite me to their meetup to talk about and demo Eve. We had a great time talking about Loopy, AirTable, and various other projects related and not related to Eve. Hopefully we can do it again when we have more to show here.

Copenhagen, April 26

Zubair Quraishi is again hosting an Eve meetup in Copenhagen, scheduled for April 26. You can view all the relevant details on the meetup page, or join the discussion on the mailing list.

San Francisco, May TBD

We’re going to be holding our first official Eve meetup at the Eve office in downtown San Francisco in May. We don’t have any concrete details yet, but we wanted to let you know this is in the works. If you are interested in attending or have any ideas of what you’d like to learn, drop me a line via e-mail or Twitter. We’ll let you know when plans are finalized.