I'm here to talk about Resh, which is a program in language that I made a couple of years ago,
and I'm just going to show you an example to start off with.
So here's an example program in Resh, this program reads two numbers and add them together.
And there's a twist to this language, which I'll just demonstrate straight away.
So now let's go to my example directory, then I'm going to run this.
And then, as you saw, sorry, as you saw on this code, it asks for a number, then it reads
the number, then it asks for a second number, and then it reads the second number, and then
it prints them.
But this re-command is a special command, so let's try to run it.
So it asks for the first number, but then it immediately terminates, so let me try to then
actually enter a number four, then it asks for the second number, and immediately terminates
again.
So let's enter a new number, and then finally it prints the final line of the program, which
asks to two numbers.
So this program in language on a very simple level is like shell scripting, but whenever
you have this re-command which also exists in functional batch, it will terminate the program,
save the entire program state, and then when you start the program again, it will continue
from exactly the real instruction, taking the arguments as the value of that statement.
That is really the basics of this program in language.
So now I have talked to you about resh, so one important part of about this is actually
the background of this, so I have to talk about the motivation for even creating this
language, that's extremely important.
So I took this picture approximately 10 years ago, but in my using my Sony Ericsson
phone, that's why the quality is not so great.
This is from the University, what I was studying in computer science, and we had a lunch
club.
So this is like a club where every day at 12 or so we would need an eat lunch, and how
do you manage that?
So let's try to write it out.
So I'm using Prolog here, resh doesn't use Prolog, Prolog is a different program in
language, but I'm using it here these slides to kind of explain how the logic fits
together, because there's a legacy, nesting of logic that is necessary to understand
like the origins of fash.
So the way to read this is this is a predicate, so the predicate is can manage a lunch
club, and then this colon dash that is kind of how, so this sentence is you can manage
a lunch club if you can use a chat bar.
So sometimes when you enter a project, some architectural decisions have already been made
for you, and once I joined this lunch club, they had already decided, upfront, several years
before that the way to manage this club was to a chat bar.
So that was something someone else had decided, I had to live with it, and then there's
some other things like how to use a chat bar, you can use a chat bar if you have IRC.
So you don't need to know what IRC is, I'll just explain it, it's an old chat protocol
incident related chat, so it is similar to some of the newer things like matrix, just older,
and a bit simpler.
So you could also infere user chat bar in newer protocols, but in practice this IRC
decision had also been made for me, so that's how it is, I'll get back to that later.
So let's just clarify, so we can see that we can use a chat bar for lunch, bookkeeping,
if we use the chat bar at lunch time, that is kind of the basic idea, but then we have
to think about, that kind of leaves us, what about all the other times of the day,
where it's not lunch time, I mean the chat bar just runs 24 hours a day, what are you going
to do with it when it's not lunch time?
So I think we try a couple of things, I can just for some additional context, I'll just
show you, we make this visualization, you don't need to be able to read any of this, again,
this is nothing to do with rest, this is still the background, I'll get back to fashion a bit.
So for example, this visualization just shows the scope of the lunch club, I mean the arrows
here, they describe, I think, kind of which items report in together with other items,
so you could see something like hot wings, we're bought often together, we're wet, but
it's not often together with hot wings or something, it's like a very complicated data and
analysis, I actually got some ECTS points for this, so that's very nice, again, this is
just to show that the lunch club was a big deal, let's get back to Resh, so the idea is,
we have this bookkeeping, we're going to use the chat bar for something else as well, so
the typical example is, you want to use it for games, but I put this colon dash here,
which means that's the condition, so the idea is, you can use the chat bar for a game,
if this game is viable for the IRC medium, and IRC is text based, so we have to say, if a game
has to be viable for IRC, it has to be the case that the shunger of the game is text based,
that is really a core, a bit requested, so we can think of some few examples, like what
is a good game for the text based shunger, I wrote here an example, called Funny Remax,
so this is like kind of a one-shot thing where you send a command to the chat bar, and
then it prints something funny, I can just show you an extremely bad example, so usually
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,
so I will not show you an example right now, but just imagine, you asked the bot for a joke,
and then the replies with a bad joke, that is kind of one example of, let's say, an easy
to implement commands, but it is also, it gets sparring in the end, so what is more fun,
state-based games, so an example could be jeopardy, so in jeopardy the state is that the
bot asks you an answer, and then you provide a question, so that is the state that
has to be kept track of, another example is this conduct for game where the state is
how many tokens you have in this grid, and that example is real fortune where the state
is how much of the world has been revealed, so there are so many examples, and many of these
examples actually work well in a sixth-based setting, so that is a new environment, so we say
that we can play a game, if it is a state-based game, but then we also have to listen,
the digital requirement that actually need to be able to keep the state somehow, so that's
obvious candidates for being able to keep state, one is to just run a background process,
so we have to kind of demon that just never exits, so it keeps the state in memory, and
another obvious candidate is to do some manual state file handling, so in your program,
you just keep writing to a file, and there was something happens, and then exit, and
then you read from that file when you re-open, and you do that manually, you could check
up the state that way, both of these approaches work, they don't exactly fit our model,
the manual state file handling works, but you have to keep track of that manually yourself,
you have to remember, oh my, I wrote this file, now I have to read this as an extra manual
bookkeeping amount, you can still do it, but it's a bit annoying, for background processes
that is also something you can do, but it is a bit brittle, right, because if you have
this long running butt, and you start a background process, what happens if something goes
wrong, and you forget about it, then you never clean up, then you just end up with hundreds
of background processes, that somehow is still running in some kind of zombie mode, so it's
something that you have to be very careful about, and we are extremely uncuffled in all
of our programming in this chatbot, so it doesn't really fit with a very defensive coding
style, because you have to think about what you're doing, and that adds another layer of
having to really be careful, so that's why the idea was to instead use rash, so let's try
to focus on this, I will go into rash more now, so this is just moving it on the head,
so if we try to put it like the other direction and start with the premise and end with
the conclusion, we can say that the premise is that if we have rash, then we can keep
state, which means that we can play a game, if that game is state based, which means that
if the game is then a text based game, then it is viable for IRC, which means we can use
a chatbot for this game, so now I will go back to rash, I've given you the motivation,
so as I said, no background process, automatic state management through files, but you don't
manually specify the files rash handle is that for you, the only place where that happens
is on read instructions, if you have read instruction, the program will terminate, safety
inside program state, then when you rerun it, it will go back and read that state, so let's
talk about language design, you may have heard of this article, GoToStatement considered
harmful, it's a very famous article, but I did not read it, this is the collection of languages
in our chatbot repo, as you can see the most, the biggest one is Schilswick, so the obvious
candidate is to combine a simple and Schilswick, and it actually composes really nicely, so let
me show, let me show a bigger example, so this is a guest number game, so I can just show you,
let me show it and he max that's better, yes, so now I also introduce labels, so this is
like an assembly, we have a guest label, and then we have this JC jump zero, so it jumps if the exit
code of the previous command is zero, and then we have to more labels like if the guest is to low
or if the guest is to high or if it's correct, so we can just try to run this, try and
guest the number, what's a good number, 42, no that's too high, then we can do some kind of
binary searching or something, 20, no that's even okay 10, what's 5, oh no, whoa, thank you, thank you
so let's talk about future work, so this just showed that you can also do looping and looping
is just like in the same way that works, yeah, so I come to first and as a heck, but I also work in
industry, like just like a notebook and so I know how interested does it, and I just found these
examples of all these turbo prefix languages, so I thought actually I've offended my suggested
it because he used to work with Delphi, he suggested turbo rush, so that is going to be the next
name, I think, also I admit that I like this assembly shield, but it is also slightly problematic
if you want to do bigger programs, so I also think it could be nice to improve the syntax,
have some kind of more structured programming, also right now rest cannot read environment variables,
so you have to start like a shield, that like a best shield or something, and then read from that,
it's a bit inefficient, we still have to ensure backwards comes with velocity because we have at least
10 programs that use rush out on the wire, so that will have to keep working, I have some ideas
for how to do this rush, the introvert, so it's written Haskell, so it's used to add some
new abstractions, I think that can be done pretty easily. Also better piping, so I showed you before,
just let's go here, so to actually find the initial random number, first is called sick,
then it sort steps, so it finds 100 numbers, that sort it, and then in the end calls hit to find the
first number, and that works, but it would be nicer if this was an actual piping because right now
if we step saves the entire value, so there's no streaming right now, and I think it would
be really nice to have some proper streaming, it also complicates matters a bit because you cannot
have like streaming in progress if you also want to save the state, but I think probably something
can be done as well. Yeah, it's a great language, it works, you can try it out, it's a link,
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.
A great, can also minimalism, I think you make a top complicated already.
Don't do streaming, so questions and the next speaker can set up.
Hi, thank you for the talk, there is another rush, it's also something with shells, it's written
in the record, and it's unfortunately OSHA loving your project, and it's also interesting,
and it's also about composition of lisp scheme and shell well-bash, and I like the notion of
composition because that's the essence of programming, in fact, in your case, it's shell and assembly,
and it's a pity that you are OSHA loving. Yes, okay, but then I'll just rename it to
turbo-bash on short trash. I gave the talk on rush three years ago.
In your defense, rush is a perfectly good name because rush is spread, so it's going to just get
a double craft all the shells. Yeah, rush is spread it, call it geeksrash.
Any more questions? Yeah, you can ask it.
Nope, because it will just pick whatever first person is doing that. I mean, it's just based on files,
so if so as long as the file read is doing it in a bubble-dark version, yeah, no, sorry.
Yeah, so it's only an issue if your file system is weird, but yeah.
Any more questions? If not, oh, yeah.
Okay, so the question is where the status kept, this follows the xdg standard, so it's kept in
poems less.locals less states, I think, but you can also configure it to be some files.
Yeah, yeah, I mean, it is kind of the same, just worse, so yeah, absolutely.
No, but you're right. I mean, that's the similar idea, just more theoretically you will found it.
But yeah, you're welcome to join us on the DICU channel on Libera.chaps. If you want to play around with
our chatbot, it has many of these stateful games. Unfortunately, they all end Danish, but we can
translate for you. Thank you.