diff options
author | EmacsConf <emacsconf-org@gnu.org> | 2023-12-02 13:35:16 -0500 |
---|---|---|
committer | EmacsConf <emacsconf-org@gnu.org> | 2023-12-02 13:35:16 -0500 |
commit | 8f15985f7daf2150f63078a4d3a22d99a2144da6 (patch) | |
tree | cf2cd3bfc57603cc18da82d052210ab61a1b2fcb /2023/captions | |
parent | 941cffa2ffe8f7164e5b7a65b72001e627695084 (diff) | |
download | emacsconf-wiki-8f15985f7daf2150f63078a4d3a22d99a2144da6.tar.xz emacsconf-wiki-8f15985f7daf2150f63078a4d3a22d99a2144da6.zip |
Automated commit
Diffstat (limited to '')
2 files changed, 627 insertions, 0 deletions
diff --git a/2023/captions/emacsconf-2023-eval--editor-integrated-repl-driven-development-for-all-languages--musa-alhassy--main--chapters.vtt b/2023/captions/emacsconf-2023-eval--editor-integrated-repl-driven-development-for-all-languages--musa-alhassy--main--chapters.vtt new file mode 100644 index 00000000..01b7ca18 --- /dev/null +++ b/2023/captions/emacsconf-2023-eval--editor-integrated-repl-driven-development-for-all-languages--musa-alhassy--main--chapters.vtt @@ -0,0 +1,20 @@ +WEBVTT + + +00:00:04.880 --> 00:00:35.989 +Introduction + +00:00:35.989 --> 00:03:35.809 +The wonders of C-x C-e + +00:03:35.809 --> 00:04:51.143 +An overview of REPL Driven Development + +00:04:51.143 --> 00:07:28.029 +REPL Driven Development with Java + +00:07:28.029 --> 00:07:59.669 +Bring your own Read Protocol + +00:07:59.669 --> 00:09:37.029 +Use Case: RDD & Job Interviews diff --git a/2023/captions/emacsconf-2023-eval--editor-integrated-repl-driven-development-for-all-languages--musa-alhassy--main.vtt b/2023/captions/emacsconf-2023-eval--editor-integrated-repl-driven-development-for-all-languages--musa-alhassy--main.vtt new file mode 100644 index 00000000..a0242577 --- /dev/null +++ b/2023/captions/emacsconf-2023-eval--editor-integrated-repl-driven-development-for-all-languages--musa-alhassy--main.vtt @@ -0,0 +1,607 @@ +WEBVTT captioned by bhavin192 + +NOTE Introduction + +00:00:04.880 --> 00:00:10.000 +Hello, and welcome to EmacsConf 2023! + +00:00:10.001 --> 00:00:12.109 +My name is Musa Al-hassy, + +00:00:12.109 --> 00:00:15.549 +and I will be talking about "REPL-driven development." + +00:00:15.549 --> 00:00:18.269 +I like programming languages so much. + +00:00:18.269 --> 00:00:20.269 +I want to use them all over the place. + +00:00:20.269 --> 00:00:23.069 +I got a PhD in the topic. + +00:00:23.069 --> 00:00:25.349 +So let's just dive in. + +00:00:25.349 --> 00:00:27.949 +This is a lightning talk, + +00:00:27.949 --> 00:00:31.309 +so the details will be available in the repository. + +00:00:31.309 --> 00:00:33.469 +Links to longer videos and GIFs + +00:00:33.469 --> 00:00:35.989 +for those who are interested. + +NOTE The wonders of C-x C-e + +00:00:35.989 --> 00:00:37.309 +So the wonderful thing about Emacs + +00:00:37.309 --> 00:00:40.589 +is that you can execute Lisp anywhere. + +00:00:40.589 --> 00:00:42.829 +For example, I can go to this piece of Lisp, + +00:00:42.829 --> 00:00:45.576 +press Ctrl-x Ctrl-e (`C-x C-e`) + +00:00:45.576 --> 00:00:47.549 +and get a little pop-up. + +00:00:47.549 --> 00:00:49.669 +Alright, so here I pressed `C-x C-e` + +00:00:49.669 --> 00:00:51.389 +and this is what it ran. + +00:00:51.389 --> 00:00:52.776 +And what this package gives you + +00:00:52.776 --> 00:00:54.509 +is the same ability + +00:00:54.509 --> 00:00:56.909 +for any language of your choosing. + +00:00:56.909 --> 00:00:59.229 +So for example, here is some Java, + +00:00:59.229 --> 00:01:02.469 +and I bound it to Ctrl-x, Ctrl-j (`C-x C-j`). + +00:01:02.469 --> 00:01:07.149 +So I say `C-x C-j`, and this runs some code, + +00:01:07.149 --> 00:01:13.709 +and over here I get a little pop-up. + +00:01:13.709 --> 00:01:15.069 +The wonderful thing about + +00:01:15.069 --> 00:01:16.829 +being able to run code from anywhere + +00:01:16.829 --> 00:01:19.029 +is that you can keep it in normal text files + +00:01:19.029 --> 00:01:20.629 +or any kind of file you like. + +00:01:20.629 --> 00:01:23.669 +For example, you can have hyperlinks, + +00:01:23.669 --> 00:01:25.109 +as it were…, like this one. + +00:01:25.109 --> 00:01:28.549 +`C-x C-e`, and now we can see this down here. + +00:01:28.549 --> 00:01:30.789 +Learn about it. + +00:01:30.789 --> 00:01:34.189 +But being able to run other languages besides Emacs + +00:01:34.189 --> 00:01:36.149 +lets us do some interesting things. + +00:01:36.149 --> 00:01:39.589 +For example, in the middle of a JavaScript program, + +00:01:39.589 --> 00:01:43.429 +you might write a line like this. `C-x C-n`. + +00:01:43.429 --> 00:01:45.229 +And that says down here + +00:01:45.229 --> 00:01:47.269 +`javascript-eval` in the mode line, + +00:01:47.269 --> 00:01:49.643 +and so this just checks that some endpoint + +00:01:49.643 --> 00:01:51.189 +is working as intended. + +00:01:51.189 --> 00:01:52.749 +So you don't need to use an external tool + +00:01:52.749 --> 00:01:53.589 +to check endpoints. + +00:01:53.589 --> 00:01:57.469 +You can just use Emacs in your favorite language. + +00:01:57.469 --> 00:01:59.629 +You know, you can keep your spirit up. + +00:01:59.629 --> 00:02:03.709 +So, `C-x C-a` runs `applescript-eval`. + +00:02:03.709 --> 00:02:06.376 +[Computer]: You can do it, buddy. + +00:02:06.376 --> 00:02:13.269 +[Musa]: Maybe you heard that in the background? + +00:02:13.269 --> 00:02:15.389 +The cool thing is, your code immediately takes form. + +00:02:15.389 --> 00:02:18.469 +Right away, you see it doing things, you know, + +00:02:18.469 --> 00:02:20.349 +altering your environment. + +00:02:20.349 --> 00:02:24.429 +For example, this is JavaScript, + +00:02:24.429 --> 00:02:28.349 +and JavaScript here is gonna change Emacs for us. + +00:02:28.349 --> 00:02:32.109 +So `C-x C-n`. And you can see down here + +00:02:32.109 --> 00:02:34.669 +`javascript-eval` was invoked. + +00:02:34.669 --> 00:02:38.789 +It returned true, and this line of JavaScript + +00:02:38.789 --> 00:02:41.709 +altered our Emacs. So that's really nice. + +00:02:41.709 --> 00:02:43.749 +So you don't need to use just Emacs Lisp if you like. + +00:02:43.749 --> 00:02:46.149 +You can use other systems. + +00:02:46.149 --> 00:02:50.069 +As you saw, the output is shown in overlays. + +00:02:50.069 --> 00:02:52.869 +So here's, for example, `C-x C-p` to run + +00:02:52.869 --> 00:02:54.109 +some Python code. + +00:02:54.109 --> 00:02:55.476 +Notice it blinked in red + +00:02:55.476 --> 00:02:56.869 +because I thought red was nice. + +00:02:56.869 --> 00:02:58.389 +You can configure as you like. + +00:02:58.389 --> 00:02:59.409 +And if you hover over it, + +00:02:59.409 --> 00:03:01.869 +you can see the solution there, + +00:03:01.869 --> 00:03:04.669 +and you can see it in a variety of familiar ways + +00:03:04.669 --> 00:03:08.709 +if you use `C-x C-e` regularly. + +00:03:08.709 --> 00:03:09.989 +You can insert the results. + +00:03:09.989 --> 00:03:14.269 +You can find documentation about them. + +00:03:14.269 --> 00:03:15.989 +The idea here is that + +00:03:15.989 --> 00:03:20.389 +you have this familiar Lisp workflow + +00:03:20.389 --> 00:03:24.989 +with `C-x C-e`, and this package ports it over + +00:03:24.989 --> 00:03:27.069 +to your favorite language out. + +00:03:27.069 --> 00:03:28.343 +So you can eval things, + +00:03:28.343 --> 00:03:30.789 +you can insert them, and do as you like. + +00:03:30.789 --> 00:03:35.809 +I think that's really neat. + +NOTE An overview of REPL Driven Development + +00:03:35.809 --> 00:03:37.209 +This package allows you to do + +00:03:37.209 --> 00:03:39.109 +REPL driven development. + +00:03:39.109 --> 00:03:42.309 +In that, you can use it to grow your program. + +00:03:42.309 --> 00:03:43.709 +You don't need to restart it. + +00:03:43.709 --> 00:03:45.549 +You can see changes live. + +00:03:45.549 --> 00:03:50.149 +So here's, for example, this is in a Java runtime. + +00:03:50.149 --> 00:03:52.869 +You can see some balls bouncing around. + +00:03:52.869 --> 00:03:54.509 +I don't really know which one is the second one, + +00:03:54.509 --> 00:03:57.229 +but let's increase its size. `C-x C-j`. + +00:03:57.229 --> 00:04:00.189 +And this one increased in size, + +00:04:00.189 --> 00:04:02.189 +and you can see down here I pressed `C-x C-j`. + +00:04:02.189 --> 00:04:05.549 +Let's change the color to blue, + +00:04:05.549 --> 00:04:09.309 +`C-x C-j`, the color is blue. + +00:04:09.309 --> 00:04:12.376 +So all these changes are happening live. + +00:04:12.376 --> 00:04:14.429 +Three balls isn't really a ball pit. + +00:04:14.429 --> 00:04:18.989 +Let's go to 50 balls. There you go. + +00:04:18.989 --> 00:04:21.469 +So it's nice that you can do this + +00:04:21.469 --> 00:04:23.209 +without leaving your environment, + +00:04:23.209 --> 00:04:26.189 +without building, you can rapidly modify and see. + +00:04:26.189 --> 00:04:29.776 +I think that's nice. + +00:04:29.776 --> 00:04:32.829 +Unfortunately, I'm at the halfway point, + +00:04:32.829 --> 00:04:35.309 +so I won't be able to work through + +00:04:35.309 --> 00:04:37.109 +some of these nice problems, + +00:04:37.109 --> 00:04:38.676 +but you can see the videos + +00:04:38.676 --> 00:04:41.509 +or GIFs on the associated repo. + +00:04:41.509 --> 00:04:42.709 +Likewise for this one. + +00:04:42.709 --> 00:04:43.909 +This one would have been a lot of fun, + +00:04:43.909 --> 00:04:46.509 +but unfortunately, we're running short on time. + +00:04:46.509 --> 00:04:51.143 +Apologies. + +NOTE REPL Driven Development with Java + +00:04:51.143 --> 00:04:56.209 +The neat thing here is: this package tries to + +00:04:56.209 --> 00:05:00.269 +bring the feeling of Lisp to other languages. + +00:05:00.269 --> 00:05:03.509 +So the idea of a REPL, or a Read Eval Print Loop + +00:05:03.509 --> 00:05:06.949 +is R and P are data interchange protocols. + +00:05:06.949 --> 00:05:09.869 +Unfortunately, not every language has those, + +00:05:09.869 --> 00:05:12.709 +but this package kind of encourages us to + +00:05:12.709 --> 00:05:14.643 +implement them if we don't have them. + +00:05:14.643 --> 00:05:16.909 +Let me show you an example. + +00:05:16.909 --> 00:05:20.589 +What do I mean here? + +00:05:20.589 --> 00:05:22.709 +This is a Java file. + +00:05:22.709 --> 00:05:25.189 +I've loaded this definition in. + +00:05:25.189 --> 00:05:28.543 +We can press `C-x C-j`, + +00:05:28.543 --> 00:05:30.909 +and you see it's a list of person. + +00:05:30.909 --> 00:05:33.829 +I didn't give this a name, so its name is $59. + +00:05:33.829 --> 00:05:40.829 +If I hover over it, we can see the definition again. + +00:05:40.829 --> 00:05:44.429 +So it's a person called Hamid, age 5, + +00:05:44.429 --> 00:05:46.229 +another person called Jaafar, age 6. + +00:05:46.229 --> 00:05:52.229 +This pretty printing is nice for me as a human, + +00:05:52.229 --> 00:05:56.349 +but I can't execute this. This isn't valid Java. + +00:05:56.349 --> 00:06:00.609 +So I could do `C-u C-x C-j`. + +00:06:00.609 --> 00:06:05.109 +If I have the help of a read protocol inserted. + +00:06:05.109 --> 00:06:09.469 +Sorry, `C-x C-j`. There it is. + +00:06:09.469 --> 00:06:12.549 +So look, it gives me a `new Person` + +00:06:12.549 --> 00:06:14.349 +with the construction everything. + +00:06:14.349 --> 00:06:16.549 +Now I can work with. + +00:06:16.549 --> 00:06:17.949 +Java can work with this. + +00:06:17.949 --> 00:06:21.709 +So this can be quite useful for regression testing + +00:06:21.709 --> 00:06:25.749 +or just to find out what your method spits out. + +00:06:25.749 --> 00:06:29.869 +We can do the same thing. Here's a bigger example. + +00:06:29.869 --> 00:06:32.389 +Trying to see it in the overlay is a bit cramped. + +00:06:32.389 --> 00:06:34.589 +We can say `C-u C-x C-j`. + +00:06:34.589 --> 00:06:38.669 +All right, and now we have executable code. + +00:06:38.669 --> 00:06:40.876 +Okay, this is neat. + +00:06:40.876 --> 00:06:42.389 +If you want to do something with it. + +00:06:42.389 --> 00:06:45.789 +I'm not really interested. I have four new persons. + +00:06:45.789 --> 00:06:49.309 +If I really want to look at this, + +00:06:49.309 --> 00:06:55.649 +I can say `M-x java-eval-navigate-output`, + +00:06:55.649 --> 00:07:00.829 +and now I see my output as this hierarchical tree. + +00:07:00.829 --> 00:07:03.589 +I go down, I can see what's inside these, + +00:07:03.589 --> 00:07:06.709 +what's the type of this thing, what's in there. + +00:07:06.709 --> 00:07:09.349 +All right, so that's nice. + +00:07:09.349 --> 00:07:14.189 +The idea is that we're not limited to + +00:07:14.189 --> 00:07:15.629 +just textual output. + +00:07:15.629 --> 00:07:19.589 +We can render output, + +00:07:19.589 --> 00:07:22.229 +thanks to the power of Emacs, in any way we want. + +00:07:22.229 --> 00:07:26.749 +In a browser, in a LaTeX file, in an Org mode (file), + +00:07:26.749 --> 00:07:28.029 +however we really desire. + +NOTE Bring your own Read Protocol + +00:07:28.029 --> 00:07:32.989 +And if our language doesn't have an easy protocol, + +00:07:32.989 --> 00:07:36.143 +so what I did for Java in particular was: + +00:07:36.143 --> 00:07:38.643 +you take a blob, and you use some + +00:07:38.643 --> 00:07:43.149 +parsing expression grammars, or if you really want + +00:07:43.149 --> 00:07:44.949 +regular expression pattern matching, + +00:07:44.949 --> 00:07:46.829 +and you get some property list out, + +00:07:46.829 --> 00:07:51.349 +and then you construct an executable expression + +00:07:51.349 --> 00:07:53.149 +out of that. Like this `new Person`. + +00:07:53.149 --> 00:07:56.749 +It's nice that you can do these kind of things + +00:07:56.749 --> 00:07:59.669 +and that this software encourages you to do them. + +NOTE Use Case: RDD & Job Interviews + +00:07:59.669 --> 00:08:07.549 +So one use case I actually use + +00:08:07.549 --> 00:08:10.909 +besides learning things is… + +00:08:10.909 --> 00:08:14.776 +oops oops oopsies oopsies showing you metadata + +00:08:14.776 --> 00:08:15.509 +you shouldn't be looking at. + +00:08:15.509 --> 00:08:19.409 +Don't look at my metadata. Sorry about that. + +00:08:19.409 --> 00:08:23.209 +One place I actually use this besides learning + +00:08:23.209 --> 00:08:25.029 +and trying new libraries and APIs + +00:08:25.029 --> 00:08:26.776 +and stuff like that is, + +00:08:26.776 --> 00:08:29.509 +for example, when I interviewed for jobs + +00:08:29.509 --> 00:08:33.229 +last year (I was changing jobs), + +00:08:33.229 --> 00:08:34.676 +I would share my screen, + +00:08:34.676 --> 00:08:37.869 +and if the interviewer gave me + +00:08:37.869 --> 00:08:39.949 +some inputs and outputs to play with, + +00:08:39.949 --> 00:08:41.576 +I could do essentially + +00:08:41.576 --> 00:08:42.976 +some sort of test driven development + +00:08:42.976 --> 00:08:45.149 +and constantly evaluate things + +00:08:45.149 --> 00:08:46.589 +right in front of the interviewer. + +00:08:46.589 --> 00:08:49.949 +For some design questions + +00:08:49.949 --> 00:08:53.909 +rather than sketching out my ideas in a Google Doc, + +00:08:53.909 --> 00:08:55.509 +I would share my screen and be like, + +00:08:55.509 --> 00:08:57.989 +"Hey, here's actual executable code, + +00:08:57.989 --> 00:08:59.229 +we can stub some things out + +00:08:59.229 --> 00:09:00.576 +and have some types," + +00:09:00.576 --> 00:09:03.476 +and the idea is we can still check things + +00:09:03.476 --> 00:09:05.643 +and run them right there and then, + +00:09:05.643 --> 00:09:08.143 +which I thought was quite nice, and it helps to + +00:09:08.143 --> 00:09:10.309 +clarify your thought process, I guess. + +00:09:10.309 --> 00:09:15.149 +Anyhow, so that's my time, + +00:09:15.149 --> 00:09:19.829 +I hope you've enjoyed this little package, + +00:09:19.829 --> 00:09:22.869 +and again, sorry for the rush, + +00:09:22.869 --> 00:09:24.149 +it's a lightning talk. + +00:09:24.149 --> 00:09:29.069 +Feel free to find everything on the associated repo. + +00:09:29.069 --> 00:09:34.389 +And have a wonderful December Saturday. + +00:09:34.389 --> 00:09:37.029 +Take care! Bye bye, everyone. |