Press "Enter" to skip to content

The Eve programming language – FunFunFunction #56


good Monday morning I am mpj and you are

watching fun fun function today we are

exploring the eve programming language

also in case you haven’t already noticed

I have a bit of a golf air hair color

thing going on and the reason for that

is that today is the day after Halloween

I also still have like this residue like

black makeup residue inside of my my

ears

I am also as a result hungover from sad

hello in my energy levels are like so

today we’re just gonna do something

relaxing we’re gonna check out Eve a new

hipstery programming language that I’ve

been watching for a while and I wanted

to get into and Whitney you know what

are you just gonna have a good time so

what is Eve four years ago ah fantastic

weird and wondrous guy called Brett

Victor me to talk that he was titled

inventing on principle I’ve linked it

below and you should absolutely watch it

but the TLDR is that Brett lecture is an

X Apple engineer and it tends to invent

these amazing UI concepts and in this

particular talk he he explores the idea

of tools that give you an immediate

feedback to what you’re doing so in the

talk is made a couple of very cool

prototypes to demonstrate the ideas that

he has he shows this pretty cool

animation software with some very

innovative thoughts but the real cool

thing that he shows is this conceptual

programming environment that gives you

immediate feedback to what you’re doing

and allows you to do all kinds of cool

things like try and travel debugging and

stuff when I saw this talk I got really

excited about there being a very

different fundamentally different

way of doing software development I

think that the evolution of software

development tools has been pretty slow

in the in the last last ten years or

perhaps are slow but very very

incremental it doesn’t feel like anyone

has rethought how we do things from a

creative standpoint I feel like

programmers are still stuck in the same

Dark Ages that video editors were in

before you had digital editing so before

we had software’s like Final Cut and

iMovie and no premiere and before movies

were digital what you had to do is that

you had to take film strips and you

would have to like physically cut them

with a knife and then tape them together

it’s like that’s how you did editing and

once you’ve done that you would put it

into the back into the machine and look

through it and then you would realize oh

we should probably tremolo and then you

would have to cut them up again and then

put it back together and then put it

back into the machine that is very

cumbersome compared to how it is today

when you can just no no you just drag

the clips and you trim them a little and

you can play immediately no rendering

times or anything it just boom place you

exactly what you need and you can scrub

back and forth and see exactly where to

make the cut it’s very very interactive

but programming is absurdly enough stuck

in in this old world when you make a

change in your code there’s almost

always quite a bit of some kind of

compilation time or loading time or

something even if you have a fancy

library loading environment it’s very

rare that you have really like a

feedback cycle that is less than one

second and with native mobile

development it’s not at all uncommon

with build times that are up to a minute

long or even longer and even if you have

an environment where you actually

managed to set up a very fast save

reload compile push

show the application loop the

application will still reset its state

every time so let’s say that you have a

bog where that arises when you open a

menu and then click a thing and then add

another thing in that thing there’s a

couple of steps involved to reproduce

the bug so while you’re trying to fix

this when you make an edit you have to

wait for the thing to reload and then

you have to manually go through and

click and open the menu and then add

that thing and then do that thing and

see if your fix worked so for most

developers modern development tooling is

not like the tooling that professional

video editors has today it’s more like

the tooling that video editors had

before digital tooling existed when they

had to know do little cut there and then

you put it in and then they had to look

at the movie from start to finish in

order to see where if their edit was

good or not I really think that there is

a future where we can do better and

Brett Victor in his talk really showed a

hint of that future even though it was

just a prototype a couple of months

after that talk was released a developer

called Chris Granger is an X Microsoft

dude

he released lighttable which was a tiny

prototype app and a blog post and a

video demonstrating a real

implementation of the of the the

principles that Breck vector had shown

in his talk

it was an amazing proof-of-concept and

people were very excited and Chris

eventually ended up creating a

Kickstarter to fund the development of

light table I was a backer of this

campaign because I was super excited and

the campaign got funded and also Y

Combinator went in to fund the company

as well so the project has been very

well funded even since its inception

light table was a really fun project to

follow but eventually the

started to you know wine down and

nothing much happened and I just figured

that yeah well but a few months later

Eve arrives on the scene which is like

the next step in the evolution of this

thinking process so even is not an

editor or an IDE it’s actually a

programming language and a platform and

an editor rolled into one I realize that

this kind of tooling is very

controversial to a lot of people

although people are very fond of their

specific setup and their tooling and

that is fine but Eve has so many

interesting ideas that I think that we

should put those aside for a little bit

and allow ourselves to explore what Eve

has to say because even if we decide not

to use Eve I think that there is a lot

of things that can be learned from Eve

that we can bring back to our home

programming environments and to willings

and programming languages Eve has some

very interesting design principles so it

first of all it’s a literal programming

language or perhaps it’s called literate

programming I’m not sure I the main idea

is that you write your program sort of

like sort of like a document an Eve

program doesn’t look like a normal

program the source code it reads more

like a programming article on medium

it’s it’s flowing flowing text in

English and then there are blocks inside

it with the actual code so let me show

you an example this is the this is the

EEP programming environment you’re it’s

available with some examples at play

with Eve calm or you can run this

locally yourself it’s open source and

it’s it’s just an implementation of

a flappy bird kind of game that I just

click here and yes you know I’m supposed

to not to hit the pipes and yeah game

over on the left-hand side here you see

the source code so to speak of the

flappy eve program so it’s these header

nice headers and markdown blocks and

which explains what the software is

about and yeah the Harris is set up and

here is some code I scroll down a bit

and you see that all here some more code

blocks and they describe my control the

game world and here’s the game menus it

explains how this works you also noticed

that it the the programming language

language is very very terrorist it’s not

a lot of code here to make make this

game it’s pretty impressive how

expressive this language is and I want

to stress that this is the actual

programming environment let’s see if I

can introduce an error here or something

if I did this yeah alright you see that

I get error messages in line here and I

just changed it and it works what it’s

also cool about Eve is that everything

is centered around data I often feel

like in an object-oriented programming

languages like a lot of programming

tends to get in the way you have to

create objects and then you have to

create factories and then you have to

create factories for factories and then

you have to create design patterns in

order to yeah you know like there’s a

lot of stuff and functional programming

languages also tend to have a lot of

this fluff it’s there’s monads and

there’s there’s partials and this

currying it’s a lot like that it’s not

about the data that you’re actually

manipulating and an aim is very focused

on the data so pretty much everything in

EVE is a record and records they look

like this this is a record the first

thing that happens here is that we

commit a for records here too to our

game world let’s have a look at this

second line here

this is our record and records when I

first saw them I felt like they had a

lot of similarities to the object

literals in in JavaScript you know like

this world thing here this would have

been written like screen menu if this

I’m just making this up like this is not

few of a script but if it was I would

take the frame here and paste it in like

you can see the similarities here right

I’m gonna delete that so just like

object literals in JavaScript these

properties they are not not ordered in a

way so if I move move this code move out

here and movies before distance that’s

the same objective that’s the that is

valid just like JavaScript object

literals what confused me was these

these hash tag world thinnest they look

weird and I didn’t really understand

what they were first but they are

actually a shorthand for writing tag

world see that’s the same thing it’s

just syntactic sugar if I do the same

thing for this one obstacle the record

below it would be tag string or star

call same thing here this is this is

exactly the same thing as writing tag

obstacle I’m gonna revert that back to

the tag syntax there and the reason why

there’s a shorthand for tag is that tags

are used a ton in the e programming

language let’s go down a little bit here

to drawing the game world what is really

cool about Eve is that it is a very

simple programming language this not a

lot of things you need to learn to use

it and that is partially because it’s a

it’s a young programming language in

javascript was very simple from the

beginning but now we have generators and

we have arrow functions and we have

three different ways of declaring

variables there’s many different ways of

creating objects and lalalalala but eve

has only two operations basically

looking at records in writing to records

order and we look for Eckert’s by using

search and here we assign to the

variable world every record that matches

this pattern and remember that this

thing here this is the same thing as

writing tag world it’s just for time for

that

and I’m gonna write go up here and write

this out again to remind you of this tag

world so up here we have committed this

record and this search operation here

will as soon as one of those records

appear it’s going to slurp that up and

for every every world that it sees every

world record that is going to be

assigned to the world variable and then

it’s going to proceed executing this

block and reverse this this happens for

every world we only have one world here

but if we had multiple of them like

these obstacles here for example these

are multiple obstacles that are being

committed as records to the game world

then this this search operation would

match all of them and it would design it

would run through this thing for every

every one of those records a subtle

thing is that these things here like the

blocks are not necessarily executed in

order this might be executed after this

block for instance like the ordering of

these blocks does not really matter to

eat ordering of

coleus doesn’t have much of a

consequence in Eve because everything

executes as everything is reactive

basically so this thing will execute as

soon as there is any change to the

record set set of records in the

database that are tagged with world so

as soon as this block here it has a

world before this this commit line here

is is executed this code will basically

not proceed so the first time this code

is running we won’t really see a world

and this block will not execute it won’t

will not will not continue so search is

kind of like this filter or kind of like

an events kind of sort of like an event

listener maybe

and this is the callback to that event

listener kind of so once we have our

world will proceed to this commit block

here commit blocks they write records

search observes records according to a

pattern and commit blocks they write

records and commit blocks can operate on

a database in this case the database is

the browser database and the database

and Eve is I guess kind of like I

interpreted as just a bucket where you

can put records and the browser database

it is observed by some browser bindings

that Eve has and that is what is drawing

things on screen so you actually don’t

manipulate the Dom directly in Eve

instead you write and create records in

the browser database so here I not

completely sure what is going on here

this here is a if you look at this this

is a div record right so this is again

just a record with a tag name of

but it’s syntactic sugar for that and a

div whenever browser sees a record with

what divs it’s going to draw those draw

those to the screen and whenever eve

sees records dave records div div

records with with the tag div written to

the browser database it’s going to draw

the equivalent equivalent divs to the

Dom in in the actual browser so you see

here that this is basically as Dom it

has style and you see here again just

like Java Script object literals Eve

records can contain other Eve records so

this style attribute here it contains

yet another record inside of it is user

select and it has some Java is CSS and

some fancy CSS and some some SVG

children I guess that this okay this is

the game window this is some kind of

rectangle this is this is an image this

is okay this is the background and then

there’s some other rectangle I don’t

know exactly what these things are but

it’s stuff that is being drawn to this

SVG on the screen this little buddy here

this is a merge operator so what that

means is that all this stuff here this

this div which contains all of all these

children I think that this is all just

one big div that is being merged into

the world record so I guess that world

record will also get a tag damn this

thing confuses me a bit perhaps somebody

that is more familiar with Eve can can

explain it or somebody that can just

read docs unlike me like are you feel

confused about the fact

that records can have multiple tags to

me that is unnatural perhaps it’s just

because I think of them too much as

JavaScript JavaScript objects but I

don’t know it’s just weird but I think

that this results in in the world

getting all of this stuff inside of its

world is is actually both the div and

the director that maintains stuff like

gravity and frame not entirely sure so

when I see them merch operating I tend

to think a little bit of object or

design in in JavaScript or the dot dot

dot operator in year 7 what else should

we check out we can check out how score

calculation works that’s pretty

interesting

do you see here like remember the the

search operator search toaster thing

search if I scroll up again and see like

here where we drew the game world here

we were basically just let me as change

that back to the original – yes world

here we were searching for records that

were had the tag world but you can like

this this pattern can be be much more

than that you can see here like in the

score calculation here we also add

distance here to the pattern and this

means that this this bind block here

that is associated with the search will

execute every time we get a world with a

new distance so as soon as distance

updates on the world this bind block

will be rung for that world you see the

bind here it updates the world’s the

world’s score this operator here that

means to set

this attribute on on the world object

and it just takes the the distance of

love the world basically how far we’ve

gotten with our flappy flappy bird and

then we assign that to the score after

we floor it so that we don’t get get

decimals this is by the way how you call

functions in and I haven’t gotten too

much into that yet sort of fully

understand it but there is a bunch of

built-in functions in in even they look

like this you just call floor and then

these these brackets here so you don’t

use parenthesis like you was doing in

most programming languages and that is

actually to emphasize the fact that

functions are also records in in eve so

it’s not a functional oriented

programming language it’s actually a

record oriented programming language I

guess or perhaps pattern based also a

thing that I really like is that

function arguments or they are not

ordered so in most programming languages

nor would have like there would be value

one value two and so forth like they it

would just be like the order of the

parameters determine what what’s value

it was but in in EVE this all of it is

again records so you see here like

distance is being assigned to the

parameter value that is being passed to

floor so if it had any more parliaments

that you would have to pass the floor

like say o to one or something and you

would assign that value here so you can

always infer infer what the hell is

going into the the function without

actually going into looking at the

method the function signature you can

even see it just by looking at it which

is very nice you see how that we use

buying the key

to change the score and up here we use

commit I’m not completely sure about the

difference between two I know that bind

is aware of the lifecycle of of the

records that it’s matching while commit

just just does whatever thing it does

permanently so if there is a record that

is it’s going to disappear after after a

while they will still these these

records that commit crates will still

persist while stuff that for instance

here like the browser is binding the

screen menu thing it will add these

these text items here but as soon as

this stops matching these records will

also also also die bind basically sort

of matches in life cycle or of the

objects that it’s matched so if it

creates them they will also have a short

life cycle I’m not completely sure still

figuring this out I’m not even sure if

this is a good way to program but I’m

very excited about it somehow it’s just

so different and intriguing and it’s

your fun it makes my brain go all tingly

good good good I encourage you all to go

to play with Eve Tom and as soon as you

do you will end up at this this

QuickStart which is actually an editable

environment is pretty cool so if I

remove this and it will updates over

here see or I can just stop stop stop

stop stop tonight I run again in updates

and it will walk you through the basic

concepts of records and clocks and teach

you how to write an application Soria

Eve pattern-matching cool programming

language you should check it out

you have just watched an episode of fun

fun function I release these every month

morning Oh 800 GMT if you haven’t

already you should check out the channel

below and see if it’s something that you

like won’t you consider subscribing to

me

I am mgj until next Monday morning stay tuned

Please follow and like us: