WEBVTT

00:00.000 --> 00:16.120
I'm here to talk about Resh, which is a program in language that I made a couple of years ago,

00:16.120 --> 00:19.480
and I'm just going to show you an example to start off with.

00:19.480 --> 00:26.840
So here's an example program in Resh, this program reads two numbers and add them together.

00:26.840 --> 00:30.760
And there's a twist to this language, which I'll just demonstrate straight away.

00:30.760 --> 00:37.480
So now let's go to my example directory, then I'm going to run this.

00:37.480 --> 00:47.320
And then, as you saw, sorry, as you saw on this code, it asks for a number, then it reads

00:47.320 --> 00:51.760
the number, then it asks for a second number, and then it reads the second number, and then

00:51.760 --> 00:53.520
it prints them.

00:53.520 --> 01:00.520
But this re-command is a special command, so let's try to run it.

01:00.520 --> 01:05.960
So it asks for the first number, but then it immediately terminates, so let me try to then

01:05.960 --> 01:11.000
actually enter a number four, then it asks for the second number, and immediately terminates

01:11.000 --> 01:12.000
again.

01:12.000 --> 01:18.000
So let's enter a new number, and then finally it prints the final line of the program, which

01:18.000 --> 01:19.760
asks to two numbers.

01:19.760 --> 01:26.600
So this program in language on a very simple level is like shell scripting, but whenever

01:26.600 --> 01:32.400
you have this re-command which also exists in functional batch, it will terminate the program,

01:32.400 --> 01:38.400
save the entire program state, and then when you start the program again, it will continue

01:38.400 --> 01:45.600
from exactly the real instruction, taking the arguments as the value of that statement.

01:45.600 --> 01:48.440
That is really the basics of this program in language.

01:48.440 --> 01:53.760
So now I have talked to you about resh, so one important part of about this is actually

01:53.760 --> 01:58.040
the background of this, so I have to talk about the motivation for even creating this

01:58.040 --> 02:01.360
language, that's extremely important.

02:01.360 --> 02:08.960
So I took this picture approximately 10 years ago, but in my using my Sony Ericsson

02:08.960 --> 02:11.840
phone, that's why the quality is not so great.

02:11.840 --> 02:21.400
This is from the University, what I was studying in computer science, and we had a lunch

02:21.400 --> 02:22.400
club.

02:22.400 --> 02:28.960
So this is like a club where every day at 12 or so we would need an eat lunch, and how

02:28.960 --> 02:31.200
do you manage that?

02:31.200 --> 02:33.680
So let's try to write it out.

02:33.680 --> 02:38.480
So I'm using Prolog here, resh doesn't use Prolog, Prolog is a different program in

02:38.480 --> 02:43.880
language, but I'm using it here these slides to kind of explain how the logic fits

02:43.880 --> 02:48.480
together, because there's a legacy, nesting of logic that is necessary to understand

02:48.480 --> 02:51.000
like the origins of fash.

02:51.000 --> 02:58.200
So the way to read this is this is a predicate, so the predicate is can manage a lunch

02:58.200 --> 03:07.200
club, and then this colon dash that is kind of how, so this sentence is you can manage

03:07.200 --> 03:11.600
a lunch club if you can use a chat bar.

03:11.600 --> 03:18.480
So sometimes when you enter a project, some architectural decisions have already been made

03:18.480 --> 03:24.080
for you, and once I joined this lunch club, they had already decided, upfront, several years

03:24.080 --> 03:29.520
before that the way to manage this club was to a chat bar.

03:29.520 --> 03:34.200
So that was something someone else had decided, I had to live with it, and then there's

03:34.200 --> 03:43.080
some other things like how to use a chat bar, you can use a chat bar if you have IRC.

03:43.080 --> 03:48.600
So you don't need to know what IRC is, I'll just explain it, it's an old chat protocol

03:48.600 --> 03:54.840
incident related chat, so it is similar to some of the newer things like matrix, just older,

03:54.840 --> 03:57.040
and a bit simpler.

03:57.040 --> 04:03.880
So you could also infere user chat bar in newer protocols, but in practice this IRC

04:03.880 --> 04:10.400
decision had also been made for me, so that's how it is, I'll get back to that later.

04:10.400 --> 04:20.240
So let's just clarify, so we can see that we can use a chat bar for lunch, bookkeeping,

04:20.240 --> 04:26.680
if we use the chat bar at lunch time, that is kind of the basic idea, but then we have

04:26.720 --> 04:34.440
to think about, that kind of leaves us, what about all the other times of the day,

04:34.440 --> 04:40.480
where it's not lunch time, I mean the chat bar just runs 24 hours a day, what are you going

04:40.480 --> 04:43.800
to do with it when it's not lunch time?

04:43.800 --> 04:48.680
So I think we try a couple of things, I can just for some additional context, I'll just

04:48.680 --> 04:54.800
show you, we make this visualization, you don't need to be able to read any of this, again,

04:54.840 --> 04:59.120
this is nothing to do with rest, this is still the background, I'll get back to fashion a bit.

04:59.120 --> 05:04.280
So for example, this visualization just shows the scope of the lunch club, I mean the arrows

05:04.280 --> 05:13.520
here, they describe, I think, kind of which items report in together with other items,

05:13.520 --> 05:20.920
so you could see something like hot wings, we're bought often together, we're wet, but

05:20.960 --> 05:25.680
it's not often together with hot wings or something, it's like a very complicated data and

05:25.680 --> 05:30.640
analysis, I actually got some ECTS points for this, so that's very nice, again, this is

05:30.640 --> 05:37.640
just to show that the lunch club was a big deal, let's get back to Resh, so the idea is,

05:37.640 --> 05:42.720
we have this bookkeeping, we're going to use the chat bar for something else as well, so

05:42.720 --> 05:48.760
the typical example is, you want to use it for games, but I put this colon dash here,

05:48.760 --> 05:54.040
which means that's the condition, so the idea is, you can use the chat bar for a game,

05:54.040 --> 06:07.000
if this game is viable for the IRC medium, and IRC is text based, so we have to say, if a game

06:07.000 --> 06:14.800
has to be viable for IRC, it has to be the case that the shunger of the game is text based,

06:14.800 --> 06:23.480
that is really a core, a bit requested, so we can think of some few examples, like what

06:23.480 --> 06:30.760
is a good game for the text based shunger, I wrote here an example, called Funny Remax,

06:30.760 --> 06:36.080
so this is like kind of a one-shot thing where you send a command to the chat bar, and

06:36.080 --> 06:41.320
then it prints something funny, I can just show you an extremely bad example, so usually

06:41.320 --> 06:53.040
I run IRC in my e-mix, it is a, but I have had some issues today, oh, yeah, my Wi-Fi isn't great,

06:53.040 --> 07:02.120
so I will not show you an example right now, but just imagine, you asked the bot for a joke,

07:02.120 --> 07:08.480
and then the replies with a bad joke, that is kind of one example of, let's say, an easy

07:08.560 --> 07:15.320
to implement commands, but it is also, it gets sparring in the end, so what is more fun,

07:15.320 --> 07:24.280
state-based games, so an example could be jeopardy, so in jeopardy the state is that the

07:24.280 --> 07:29.120
bot asks you an answer, and then you provide a question, so that is the state that

07:29.120 --> 07:33.880
has to be kept track of, another example is this conduct for game where the state is

07:33.880 --> 07:40.280
how many tokens you have in this grid, and that example is real fortune where the state

07:40.280 --> 07:45.920
is how much of the world has been revealed, so there are so many examples, and many of these

07:45.920 --> 07:54.120
examples actually work well in a sixth-based setting, so that is a new environment, so we say

07:54.120 --> 07:58.840
that we can play a game, if it is a state-based game, but then we also have to listen,

07:58.840 --> 08:04.360
the digital requirement that actually need to be able to keep the state somehow, so that's

08:04.360 --> 08:12.080
obvious candidates for being able to keep state, one is to just run a background process,

08:12.080 --> 08:19.320
so we have to kind of demon that just never exits, so it keeps the state in memory, and

08:19.320 --> 08:26.400
another obvious candidate is to do some manual state file handling, so in your program,

08:26.400 --> 08:32.080
you just keep writing to a file, and there was something happens, and then exit, and

08:32.080 --> 08:36.120
then you read from that file when you re-open, and you do that manually, you could check

08:36.120 --> 08:46.040
up the state that way, both of these approaches work, they don't exactly fit our model,

08:46.040 --> 08:51.480
the manual state file handling works, but you have to keep track of that manually yourself,

08:51.480 --> 08:57.920
you have to remember, oh my, I wrote this file, now I have to read this as an extra manual

08:57.920 --> 09:03.640
bookkeeping amount, you can still do it, but it's a bit annoying, for background processes

09:03.640 --> 09:10.600
that is also something you can do, but it is a bit brittle, right, because if you have

09:10.600 --> 09:16.480
this long running butt, and you start a background process, what happens if something goes

09:16.480 --> 09:21.360
wrong, and you forget about it, then you never clean up, then you just end up with hundreds

09:21.360 --> 09:27.320
of background processes, that somehow is still running in some kind of zombie mode, so it's

09:27.320 --> 09:32.440
something that you have to be very careful about, and we are extremely uncuffled in all

09:32.440 --> 09:38.200
of our programming in this chatbot, so it doesn't really fit with a very defensive coding

09:38.200 --> 09:43.600
style, because you have to think about what you're doing, and that adds another layer of

09:43.680 --> 09:58.320
having to really be careful, so that's why the idea was to instead use rash, so let's try

09:58.320 --> 10:07.680
to focus on this, I will go into rash more now, so this is just moving it on the head,

10:07.680 --> 10:14.520
so if we try to put it like the other direction and start with the premise and end with

10:14.520 --> 10:22.360
the conclusion, we can say that the premise is that if we have rash, then we can keep

10:22.360 --> 10:30.480
state, which means that we can play a game, if that game is state based, which means that

10:30.480 --> 10:37.120
if the game is then a text based game, then it is viable for IRC, which means we can use

10:37.120 --> 10:44.640
a chatbot for this game, so now I will go back to rash, I've given you the motivation,

10:44.640 --> 10:51.200
so as I said, no background process, automatic state management through files, but you don't

10:51.200 --> 10:58.160
manually specify the files rash handle is that for you, the only place where that happens

10:58.160 --> 11:02.120
is on read instructions, if you have read instruction, the program will terminate, safety

11:02.120 --> 11:08.920
inside program state, then when you rerun it, it will go back and read that state, so let's

11:08.920 --> 11:13.800
talk about language design, you may have heard of this article, GoToStatement considered

11:13.800 --> 11:23.800
harmful, it's a very famous article, but I did not read it, this is the collection of languages

11:23.800 --> 11:31.000
in our chatbot repo, as you can see the most, the biggest one is Schilswick, so the obvious

11:31.160 --> 11:38.360
candidate is to combine a simple and Schilswick, and it actually composes really nicely, so let

11:38.360 --> 11:52.040
me show, let me show a bigger example, so this is a guest number game, so I can just show you,

11:52.120 --> 12:01.400
let me show it and he max that's better, yes, so now I also introduce labels, so this is

12:01.400 --> 12:10.200
like an assembly, we have a guest label, and then we have this JC jump zero, so it jumps if the exit

12:10.200 --> 12:17.240
code of the previous command is zero, and then we have to more labels like if the guest is to low

12:17.800 --> 12:22.840
or if the guest is to high or if it's correct, so we can just try to run this, try and

12:23.560 --> 12:30.520
guest the number, what's a good number, 42, no that's too high, then we can do some kind of

12:30.520 --> 12:44.600
binary searching or something, 20, no that's even okay 10, what's 5, oh no, whoa, thank you, thank you

12:44.680 --> 12:51.160
so let's talk about future work, so this just showed that you can also do looping and looping

12:51.160 --> 12:57.960
is just like in the same way that works, yeah, so I come to first and as a heck, but I also work in

12:57.960 --> 13:03.080
industry, like just like a notebook and so I know how interested does it, and I just found these

13:03.080 --> 13:09.720
examples of all these turbo prefix languages, so I thought actually I've offended my suggested

13:09.720 --> 13:16.680
it because he used to work with Delphi, he suggested turbo rush, so that is going to be the next

13:16.680 --> 13:25.720
name, I think, also I admit that I like this assembly shield, but it is also slightly problematic

13:25.720 --> 13:31.000
if you want to do bigger programs, so I also think it could be nice to improve the syntax,

13:31.560 --> 13:37.400
have some kind of more structured programming, also right now rest cannot read environment variables,

13:37.400 --> 13:44.280
so you have to start like a shield, that like a best shield or something, and then read from that,

13:44.280 --> 13:50.440
it's a bit inefficient, we still have to ensure backwards comes with velocity because we have at least

13:50.440 --> 13:57.800
10 programs that use rush out on the wire, so that will have to keep working, I have some ideas

13:57.800 --> 14:03.080
for how to do this rush, the introvert, so it's written Haskell, so it's used to add some

14:03.240 --> 14:10.680
new abstractions, I think that can be done pretty easily. Also better piping, so I showed you before,

14:11.560 --> 14:17.480
just let's go here, so to actually find the initial random number, first is called sick,

14:17.480 --> 14:24.280
then it sort steps, so it finds 100 numbers, that sort it, and then in the end calls hit to find the

14:24.280 --> 14:31.320
first number, and that works, but it would be nicer if this was an actual piping because right now

14:31.320 --> 14:39.400
if we step saves the entire value, so there's no streaming right now, and I think it would

14:39.400 --> 14:45.960
be really nice to have some proper streaming, it also complicates matters a bit because you cannot

14:45.960 --> 14:52.440
have like streaming in progress if you also want to save the state, but I think probably something

14:52.440 --> 14:59.800
can be done as well. Yeah, it's a great language, it works, you can try it out, it's a link,

15:00.360 --> 15:06.360
it works also outside of I.C. as a shared, but it also works inside of I.C. if you choose to do so, thank you.

15:14.760 --> 15:18.360
A great, can also minimalism, I think you make a top complicated already.

15:21.160 --> 15:25.000
Don't do streaming, so questions and the next speaker can set up.

15:25.800 --> 15:37.320
Hi, thank you for the talk, there is another rush, it's also something with shells, it's written

15:37.320 --> 15:45.640
in the record, and it's unfortunately OSHA loving your project, and it's also interesting,

15:45.640 --> 15:54.120
and it's also about composition of lisp scheme and shell well-bash, and I like the notion of

15:54.200 --> 15:59.720
composition because that's the essence of programming, in fact, in your case, it's shell and assembly,

15:59.720 --> 16:07.880
and it's a pity that you are OSHA loving. Yes, okay, but then I'll just rename it to

16:07.880 --> 16:14.920
turbo-bash on short trash. I gave the talk on rush three years ago.

16:17.720 --> 16:21.720
In your defense, rush is a perfectly good name because rush is spread, so it's going to just get

16:21.720 --> 16:26.520
a double craft all the shells. Yeah, rush is spread it, call it geeksrash.

16:28.520 --> 16:30.920
Any more questions? Yeah, you can ask it.

16:43.480 --> 16:48.840
Nope, because it will just pick whatever first person is doing that. I mean, it's just based on files,

16:48.840 --> 17:00.520
so if so as long as the file read is doing it in a bubble-dark version, yeah, no, sorry.

17:05.640 --> 17:10.360
Yeah, so it's only an issue if your file system is weird, but yeah.

17:14.120 --> 17:17.960
Any more questions? If not, oh, yeah.

17:19.640 --> 17:30.040
Okay, so the question is where the status kept, this follows the xdg standard, so it's kept in

17:30.040 --> 17:35.960
poems less.locals less states, I think, but you can also configure it to be some files.

17:49.800 --> 17:55.320
Yeah, yeah, I mean, it is kind of the same, just worse, so yeah, absolutely.

17:55.960 --> 18:01.960
No, but you're right. I mean, that's the similar idea, just more theoretically you will found it.

18:05.240 --> 18:12.680
But yeah, you're welcome to join us on the DICU channel on Libera.chaps. If you want to play around with

18:12.680 --> 18:17.320
our chatbot, it has many of these stateful games. Unfortunately, they all end Danish, but we can

18:17.320 --> 18:20.440
translate for you. Thank you.

