From 5b051096438bf250678fe78a864a5f55dc2274d4 Mon Sep 17 00:00:00 2001 From: Sacha Chua Date: Sat, 16 Jan 2021 01:10:58 -0500 Subject: Rename file --- ...f-2020--20-omg-macros--corwin-brust-autogen.vtt | 1446 -------------------- ...emacsconf-2020--20-omg-macros--corwin-brust.vtt | 1446 ++++++++++++++++++++ 2 files changed, 1446 insertions(+), 1446 deletions(-) delete mode 100644 2020/subtitles/emacsconf-2020--20-omg-macros--corwin-brust-autogen.vtt create mode 100644 2020/subtitles/emacsconf-2020--20-omg-macros--corwin-brust.vtt (limited to '2020/subtitles') diff --git a/2020/subtitles/emacsconf-2020--20-omg-macros--corwin-brust-autogen.vtt b/2020/subtitles/emacsconf-2020--20-omg-macros--corwin-brust-autogen.vtt deleted file mode 100644 index e9ecb9af..00000000 --- a/2020/subtitles/emacsconf-2020--20-omg-macros--corwin-brust-autogen.vtt +++ /dev/null @@ -1,1446 +0,0 @@ -WEBVTT - -00:00:00.480 --> 00:00:02.879 -Good evening again. I think I - -00:00:02.879 --> 00:00:04.319 -have a little time here - -00:00:04.319 --> 00:00:07.359 -to talk about macros. Is there - -00:00:07.359 --> 00:00:09.440 -still room in our -schedule for that, - -00:00:09.440 --> 00:00:11.440 -or should I just jump to some of - -00:00:11.440 --> 00:00:12.559 -my thoughts on the day? - -00:00:12.559 --> 00:00:15.920 -([Amin:] Pretty sure we - -00:00:15.920 --> 00:00:17.039 -have some time.) - -00:00:17.039 --> 00:00:19.039 -[Corwin:] All right. Great. -([Amin:] Yeah, go for it.) - -00:00:19.039 --> 00:00:20.720 -Well, I'll just drive into my - -00:00:20.720 --> 00:00:22.384 -prepared thing here then. - -00:00:22.384 --> 00:00:24.720 -(Amin: yeah, actually, you're -right on time, so...) - -00:00:24.720 --> 00:00:27.664 -[Corwin:] oh what an amazing thing. - -00:00:27.664 --> 00:00:31.199 -I just... You know, I have been -trying to do what I... - -00:00:31.199 --> 00:00:33.040 -I've got a big thank you planned - -00:00:33.040 --> 00:00:36.239 -at the end, but let me just say, - -00:00:36.239 --> 00:00:39.200 -it's been really cool to watch the - -00:00:39.200 --> 00:00:42.160 -way that people work together. - -00:00:42.160 --> 00:00:46.800 -([Amin:] Absolutely. It's... -This whole event today has been - -00:00:46.800 --> 00:00:50.879 -nothing but awesome, and - -00:00:50.879 --> 00:00:53.120 -no little part thanks to all of the help - -00:00:53.120 --> 00:00:56.909 -from all of you guys and everyone. - -00:00:56.909 --> 00:00:59.120 -Yeah, it's awesome. - -00:00:59.120 --> 00:01:03.065 -With that, I'll just shut up -for now. - -00:01:03.065 --> 00:01:04.891 -Take it away, Corwin.) - -00:01:04.891 --> 00:01:06.479 -[Corwin:] Who knows how to make - -00:01:06.479 --> 00:01:09.840 -make that the default in good old smex? - -00:01:09.840 --> 00:01:12.799 -All right. So I'm gonna try to continue - -00:01:12.799 --> 00:01:14.551 -my theme from the previous talk. - -00:01:14.551 --> 00:01:16.393 -I'm a longtime Emacs user, - -00:01:16.393 --> 00:01:20.240 -but I'm a pretty new person - -00:01:20.240 --> 00:01:22.380 -to trying to really understand - -00:01:22.380 --> 00:01:24.960 -what's going on within Emacs and make - -00:01:24.960 --> 00:01:28.240 -my customizations to it--simple for - -00:01:28.240 --> 00:01:30.960 -what I tend to just think of will work. - -00:01:30.960 --> 00:01:33.566 -And maybe that's a nice bow - -00:01:33.566 --> 00:01:36.240 -to put on that earlier talk. - -00:01:40.479 --> 00:01:44.981 -Let's see here now. It's C-x M-i. - -00:01:44.981 --> 00:01:48.159 -That's right. - -00:01:48.159 --> 00:01:52.960 -And let's try that again. Okay, good. - -00:01:52.960 --> 00:01:55.240 -So demoing is fun, - -00:01:55.240 --> 00:01:57.192 -but I will save most of that - -00:01:57.192 --> 00:01:59.759 -for tomorrow where my - -00:01:59.759 --> 00:02:02.750 -dear friend and co-collaborator - -00:02:02.750 --> 00:02:04.799 -in bringing you the dungeon-mode project, - -00:02:04.799 --> 00:02:07.261 -which is sort of the exciting thing - -00:02:07.261 --> 00:02:10.800 -that we hope you'll be interested in, - -00:02:10.800 --> 00:02:15.680 -gets a little more of a reveal. - -00:02:15.680 --> 00:02:19.360 -Tonight, I'll just close saying - -00:02:19.360 --> 00:02:22.640 -a few things about the process of - -00:02:22.640 --> 00:02:25.680 -making it and continuing my theme of -community. - -00:02:25.680 --> 00:02:29.760 -First of all, a specific and upfront -shout out - -00:02:29.760 --> 00:02:33.120 -to tv's wasamasa who - -00:02:33.120 --> 00:02:36.239 -absolutely shaped and guided this - -00:02:36.239 --> 00:02:38.582 -this program. I may have taken out - -00:02:38.582 --> 00:02:39.898 -a slide with your name on it, - -00:02:39.898 --> 00:02:43.599 -but thank you. - -00:02:43.599 --> 00:02:46.479 -So when we think about Emacs macros - -00:02:46.479 --> 00:02:50.239 -and the power that they give us, - -00:02:53.280 --> 00:02:54.720 -I think about them as a really - -00:02:54.720 --> 00:02:56.400 -deep rabbit hole. They confuse - -00:02:56.400 --> 00:03:00.239 -people a lot. And so, to try to center - -00:03:00.239 --> 00:03:02.480 -myself on that, I remember first that - -00:03:03.599 --> 00:03:09.599 -they're going to be talking to us -about code. - -00:03:09.599 --> 00:03:13.519 -Excuse me, I realize I hadn't -set my timer. - -00:03:13.519 --> 00:03:18.000 -Here we are. - -00:03:18.000 --> 00:03:20.543 -So a simple macro syntax is - -00:03:20.543 --> 00:03:22.239 -going to generate - -00:03:22.239 --> 00:03:25.920 -something that is implicitly confusing - -00:03:25.920 --> 00:03:27.657 -to somebody that knows the syntax - -00:03:27.657 --> 00:03:28.988 -of Emacs Lisp well. - -00:03:28.988 --> 00:03:30.785 -We see something like this - -00:03:30.785 --> 00:03:32.784 -and a veteran eye says - -00:03:32.784 --> 00:03:36.239 -"That x isn't quoted. What's going on?" - -00:03:36.239 --> 00:03:39.840 -but it can be hard to miss. - -00:03:39.840 --> 00:03:43.040 -A lot of the functions (as we'll talk - -00:03:43.040 --> 00:03:46.640 -about in a moment) that are built -into Emacs - -00:03:46.640 --> 00:03:48.572 -really are macros, so a lot of - -00:03:48.572 --> 00:03:50.480 -Emacs features work this way. - -00:03:50.480 --> 00:03:53.040 -It might be scary, but we have to look at - -00:03:53.040 --> 00:03:54.640 -it closely if we really want to get - -00:03:54.640 --> 00:03:58.400 -friendly with Emacs. - -00:03:58.400 --> 00:04:01.439 -Let's just jump right into defmacro, - -00:04:01.439 --> 00:04:03.920 -which is our key entry point. - -00:04:04.720 --> 00:04:05.833 -The notes from this talk - -00:04:05.833 --> 00:04:09.420 -include the link to that, - -00:04:09.420 --> 00:04:12.000 -which... Definitely - -00:04:12.000 --> 00:04:14.640 -read through a couple of times. - -00:04:14.640 --> 00:04:16.000 -That may take you through - -00:04:16.000 --> 00:04:19.440 -into the cl-def macro, which adds - -00:04:19.440 --> 00:04:23.440 -the Common Lisp extensions. - -00:04:23.440 --> 00:04:28.080 -Definitely challenging. - -00:04:28.080 --> 00:04:30.560 -I've struggled there, - -00:04:30.560 --> 00:04:31.759 -as we'll take a look at - -00:04:31.759 --> 00:04:34.800 -in a moment. - -00:04:34.800 --> 00:04:36.266 -So I haven't played too much with - -00:04:36.266 --> 00:04:38.320 -cl-maclet. Perhaps success in - -00:04:38.320 --> 00:04:40.804 -in that keyword space - -00:04:40.804 --> 00:04:44.320 -and figuring out what -the right balance is there - -00:04:44.320 --> 00:04:46.000 -will give me the confidence to try - -00:04:46.000 --> 00:04:51.680 -some more lexical macros. - -00:04:51.680 --> 00:04:53.402 -Let me also briefly introduce - -00:04:53.402 --> 00:04:55.134 -the comma (,) and back quote (`). - -00:04:55.134 --> 00:04:57.389 -If you have allowed your eyes - -00:04:57.389 --> 00:04:59.321 -to cross when you see these, - -00:04:59.321 --> 00:05:03.113 -that's not a shameful, -shameful thing. - -00:05:03.113 --> 00:05:06.080 -It's confusing, and we should be - -00:05:06.080 --> 00:05:07.543 -alerting each other - -00:05:07.543 --> 00:05:09.520 -when we stick macros in, - -00:05:09.520 --> 00:05:11.199 -often by putting them in - -00:05:11.199 --> 00:05:12.255 -different library spaces - -00:05:12.255 --> 00:05:14.160 -for complicated projects, - -00:05:14.160 --> 00:05:17.520 -or otherwise warning people - -00:05:17.520 --> 00:05:19.520 -that this is not an interactive function, - -00:05:19.520 --> 00:05:21.919 -even if you get away -with using it like one. - -00:05:22.639 --> 00:05:26.000 -Watch your back. - -00:05:26.000 --> 00:05:32.800 -The manual itself talks about macros - -00:05:32.800 --> 00:05:35.840 -as being a way of evaluating, - -00:05:35.840 --> 00:05:39.993 -as being an evaluator that will take - -00:05:39.993 --> 00:05:42.800 -our Emacs Lisp expression - -00:05:42.800 --> 00:05:44.800 -and the set of forms that - -00:05:44.800 --> 00:05:47.590 -will feed to it our code, - -00:05:48.960 --> 00:05:50.792 -but it also provides us with - -00:05:50.792 --> 00:05:53.467 -this concept of an environment. - -00:05:53.467 --> 00:05:57.027 -That's really where the power -comes in. - -00:05:57.027 --> 00:05:58.240 -Through that, we can have - -00:05:58.240 --> 00:06:00.080 -lexical variables and - -00:06:00.080 --> 00:06:03.199 -think about--bring in some of the - -00:06:03.199 --> 00:06:06.400 -capabilities that - -00:06:06.400 --> 00:06:09.759 -can be harder to reach with - -00:06:09.759 --> 00:06:13.840 -a pure declarative statement that - -00:06:13.840 --> 00:06:21.440 -doesn't allow for top level - -00:06:21.440 --> 00:06:28.639 -asynchronous... Asynchronicity... - -00:06:28.639 --> 00:06:31.950 -I'm gonna basically - -00:06:33.520 --> 00:06:35.577 -ignore the byte-compilation phase - -00:06:35.577 --> 00:06:36.880 -for this talk - -00:06:36.880 --> 00:06:38.463 -in order to have any prayer - -00:06:38.463 --> 00:06:39.919 -of getting through it in the - -00:06:39.919 --> 00:06:43.600 -remaining 9 or 11 minutes or whatever. - -00:06:43.600 --> 00:06:50.441 -But suffice to say, -that's a scary space, - -00:06:50.441 --> 00:06:52.240 -and that's really - -00:06:52.240 --> 00:06:53.800 -the thing that you want to - -00:06:53.800 --> 00:06:55.277 -start learning about - -00:06:55.277 --> 00:06:57.199 -as you think about - -00:06:57.199 --> 00:07:02.160 -taking macros on in earnest. - -00:07:02.160 --> 00:07:05.919 -Coming back to the comma syntax, - -00:07:05.919 --> 00:07:09.759 -then, having given ourselves a - -00:07:09.759 --> 00:07:12.479 -working definition for the Emacs Lisp - -00:07:12.479 --> 00:07:14.479 -runtime environment, then we can say that - -00:07:14.479 --> 00:07:15.840 -macros are going to - -00:07:15.840 --> 00:07:21.120 -inject code back into that stream, - -00:07:21.120 --> 00:07:25.280 -whereas backquote (`) - -00:07:25.280 --> 00:07:28.479 -is going to give code back. - -00:07:28.479 --> 00:07:31.919 -to the stream--or interject, sorry, - -00:07:31.919 --> 00:07:33.632 -it's going to interject - -00:07:33.632 --> 00:07:35.360 -back into the stream. - -00:07:35.360 --> 00:07:39.840 -Sort of an exclamatory "Excuse me, - -00:07:39.840 --> 00:07:46.966 -I'd like to have a value here." -We can take that value - -00:07:46.966 --> 00:07:48.639 -from the environment as it exists - -00:07:48.639 --> 00:07:54.160 -when our macro is evaluated. - -00:07:54.160 --> 00:07:56.003 -Backquote, on the other hand, - -00:07:56.003 --> 00:08:00.560 -takes the result from that - -00:08:00.560 --> 00:08:02.201 -and returns it back to the stream - -00:08:02.201 --> 00:08:03.467 -for evaluation at the - -00:08:03.467 --> 00:08:05.680 -processing level that invoked us. - -00:08:05.680 --> 00:08:08.720 -So in other words, perhaps back up to - -00:08:08.720 --> 00:08:10.960 -a top-level eval expression where our - -00:08:10.960 --> 00:08:16.720 -macro is invoked. - -00:08:20.080 --> 00:08:22.560 -I'm going to briefly bring - -00:08:22.560 --> 00:08:23.759 -you back to the game - -00:08:23.759 --> 00:08:27.120 -for just a moment. - -00:08:30.240 --> 00:08:32.479 -I won't linger on this slide, - -00:08:32.479 --> 00:08:37.039 -but briefly: this is a - -00:08:37.039 --> 00:08:41.615 -role-playing, pen and pencil, - -00:08:41.615 --> 00:08:43.829 -physical dice tradition - -00:08:43.829 --> 00:08:46.320 -that dates back a long time - -00:08:46.320 --> 00:08:48.080 -from a technology perspective. - -00:08:48.080 --> 00:08:50.727 -It's old in the same way - -00:08:50.727 --> 00:08:58.560 -that other tools that I like -are old. - -00:08:58.560 --> 00:09:00.185 -It's simple to understand. - -00:09:00.185 --> 00:09:01.873 -I can communicate a lot with it - -00:09:01.873 --> 00:09:03.952 -with a simple amount of typing - -00:09:03.952 --> 00:09:09.120 -or scribbling something -on a piece of paper. - -00:09:09.120 --> 00:09:13.500 -It has a complicated problem space -of its own. - -00:09:13.500 --> 00:09:15.519 -Again, I don't want to - -00:09:15.519 --> 00:09:18.212 -get too much into the game here, - -00:09:18.212 --> 00:09:20.177 -but in this talk, - -00:09:20.177 --> 00:09:22.590 -for the last five minutes, - -00:09:22.590 --> 00:09:24.751 -I'll focus on the process - -00:09:24.751 --> 00:09:26.640 -that we took to - -00:09:26.640 --> 00:09:29.190 -automate getting data out of - -00:09:29.190 --> 00:09:31.564 -the Org Mode tables -which eventually - -00:09:31.564 --> 00:09:33.855 -(as we'll talk about more -tomorrow) - -00:09:33.855 --> 00:09:36.000 -are used to draw - -00:09:36.000 --> 00:09:39.440 -game maps and other things. - -00:09:39.440 --> 00:09:42.543 -Here I talk about why we did -that. - -00:09:42.543 --> 00:09:45.279 -I'm going to skip briefly past that, - -00:09:45.279 --> 00:09:49.360 -and say instead that at a high level, - -00:09:49.360 --> 00:09:51.440 -it's symbolic informatics. - -00:09:51.440 --> 00:09:53.519 -We're giving a symbolic name - -00:09:53.519 --> 00:09:58.080 -to a tile set, - -00:10:02.000 --> 00:10:04.000 -and then assigning that tile set some - -00:10:04.000 --> 00:10:04.840 -some characteristics - -00:10:04.840 --> 00:10:06.820 -like physical speeds, screen space - -00:10:06.820 --> 00:10:08.399 -(a variable that we might - -00:10:08.399 --> 00:10:12.800 -want to swap in), and so forth. - -00:10:12.800 --> 00:10:15.200 -You know, our project rests heavily on - -00:10:15.200 --> 00:10:21.040 -Org Mode and its -fundamental capabilities. - -00:10:21.040 --> 00:10:24.000 -The code I'm going to show here - -00:10:28.320 --> 00:10:31.360 -is focused around a sticky - -00:10:31.360 --> 00:10:32.380 -problem space in - -00:10:32.380 --> 00:10:33.861 -information technology. - -00:10:33.861 --> 00:10:38.240 -I'm a professional software engineer - -00:10:38.240 --> 00:10:40.362 -turned technology architect. - -00:10:40.362 --> 00:10:43.495 -I support the websites for - -00:10:43.495 --> 00:10:46.533 -a recognizable financial services brand - -00:10:46.533 --> 00:10:48.500 -that I don't identify - -00:10:48.500 --> 00:10:50.720 -just so I don't accidentally end up - -00:10:50.720 --> 00:10:54.399 -inadvertently misrepresenting my firm - -00:10:54.399 --> 00:10:56.456 -in some financial perspective - -00:10:56.456 --> 00:10:57.760 -if I let some other - -00:10:57.760 --> 00:11:03.300 -companies' name slip, or my own. - -00:11:03.300 --> 00:11:07.700 -It's certainly no representation - -00:11:07.700 --> 00:11:11.279 -of an opinion other than my own. - -00:11:18.800 --> 00:11:22.720 -So ETL has to do with moving data around. - -00:11:22.720 --> 00:11:26.240 -We have the idea of - -00:11:26.240 --> 00:11:29.200 -a pipeline where we'll be able to verify - -00:11:29.200 --> 00:11:30.560 -certain assumptions, - -00:11:30.560 --> 00:11:32.106 -nominally about data quality, - -00:11:32.106 --> 00:11:33.600 -but it could be about anything. - -00:11:33.600 --> 00:11:35.630 -Before the pipeline starts, okay, - -00:11:35.630 --> 00:11:36.886 -we've got a state where we think - -00:11:36.886 --> 00:11:38.560 -it should work if we run it. - -00:11:38.560 --> 00:11:41.920 -We have some extraction where we'll - -00:11:41.920 --> 00:11:43.973 -get our sources, and we may have - -00:11:43.973 --> 00:11:45.040 -the opportunity to - -00:11:45.040 --> 00:11:47.327 -make some assertions there. - -00:11:47.327 --> 00:11:50.510 -In the transform stage, -as well as the load, - -00:11:50.510 --> 00:11:52.720 -things get a little dicer, - -00:11:52.720 --> 00:11:54.079 -to the point where we come out of the - -00:11:54.079 --> 00:11:55.360 -load stage and we should have some - -00:11:55.360 --> 00:11:56.676 -really solid assertions again - -00:11:56.676 --> 00:11:57.724 -that we can even go back - -00:11:57.724 --> 00:11:59.680 -and compare to the extract stage. - -00:11:59.680 --> 00:12:02.639 -From this, we have the rudimentaries - -00:12:02.639 --> 00:12:04.959 -of a data quality practice. - -00:12:04.959 --> 00:12:08.120 -In this case, we have a number of - -00:12:08.120 --> 00:12:09.360 -Org Mode files that will all - -00:12:09.360 --> 00:12:12.639 -be distributed across a - -00:12:12.639 --> 00:12:16.720 -number of players' computers, - -00:12:16.720 --> 00:12:18.959 -so we might not want to update every - -00:12:18.959 --> 00:12:20.320 -part of every buffer. - -00:12:20.320 --> 00:12:22.720 -I think it's a complicated problem space. - -00:12:22.720 --> 00:12:24.560 -So we tried to take - -00:12:24.560 --> 00:12:27.839 -a long-term view of - -00:12:27.839 --> 00:12:30.321 -the solution that we needed. - -00:12:30.321 --> 00:12:32.160 -So I'll go ahead - -00:12:32.160 --> 00:12:36.279 -and open up the function -that... - -00:12:36.279 --> 00:12:39.020 -Let's actually start with the one - -00:12:39.020 --> 00:12:41.680 -that's pretty easy to read. - -00:12:41.680 --> 00:12:46.800 -I'm gonna go ahead and -just crank it up huge, - -00:12:46.800 --> 00:12:51.680 -in case anybody's watching in 480. - -00:12:51.680 --> 00:12:57.733 -This program is not a work of art - -00:12:57.733 --> 00:13:01.120 -It's a simple implementation -of the idea that - -00:13:01.120 --> 00:13:04.000 -an alist of functions - -00:13:04.000 --> 00:13:06.633 -that return maybe some data, - -00:13:06.633 --> 00:13:10.399 -maybe some data and an entry -back into that alist, - -00:13:10.399 --> 00:13:13.040 -can be done quite extensively with - -00:13:13.040 --> 00:13:15.680 -very few lines of code. - -00:13:15.680 --> 00:13:17.586 -Neither is it an especially tight - -00:13:17.586 --> 00:13:19.600 -or thrifty implementation. - -00:13:19.600 --> 00:13:22.000 -It's just trying to get the job done - -00:13:22.000 --> 00:13:25.056 -with a doc statement for everything. - -00:13:25.056 --> 00:13:28.595 -At the heart, we see a call to - -00:13:28.595 --> 00:13:32.067 -this macro called dm-coalesce-hash, - -00:13:32.067 --> 00:13:33.714 -and that's what I'd like -to focus in on. - -00:13:33.714 --> 00:13:35.360 -You can see... I think - -00:13:35.360 --> 00:13:38.800 -that something unpleasant is -happening here. - -00:13:38.800 --> 00:13:43.991 -I've got an eval in what is... - -00:13:43.991 --> 00:13:49.519 -I will share a fairly central function - -00:13:49.519 --> 00:13:52.160 -that those implementing -this ETL pattern are - -00:13:52.160 --> 00:13:54.933 -welcome to derive from. - -00:13:54.933 --> 00:13:57.680 -That is, this is a -default transform - -00:13:57.680 --> 00:14:00.959 -that you can get when loading -certain kinds of - -00:14:00.959 --> 00:14:04.560 -org-mode tables that have been - -00:14:04.560 --> 00:14:06.399 -properly adorned. Again, we'll get - -00:14:06.399 --> 00:14:09.120 -into that all tomorrow. - -00:14:09.120 --> 00:14:11.900 -So, keeping an eye on time. -Couple minutes left. - -00:14:11.900 --> 00:14:13.760 -Let's look at the macro itself. - -00:14:13.760 --> 00:14:15.000 -I have a slide on this, - -00:14:15.000 --> 00:14:24.639 -but let's go ahead -and risk getting off page. - -00:14:24.639 --> 00:14:27.199 -Oh boy. Here we go. So this is my - -00:14:27.199 --> 00:14:28.959 -utilities bucket. - -00:14:28.959 --> 00:14:31.920 -It has such basic features as "give me a - -00:14:31.920 --> 00:14:34.000 -hash table with some defaults, I'll think - -00:14:34.000 --> 00:14:36.000 -about that later," - -00:14:36.000 --> 00:14:44.720 -and "add to list," a special version - -00:14:44.720 --> 00:14:47.600 -that enables us to be a little cavalier - -00:14:47.600 --> 00:14:49.360 -in experimenting with alist versus - -00:14:49.360 --> 00:14:50.967 -hashes versus plists. - -00:14:50.967 --> 00:14:53.178 -We've made a right mess for -ourselves - -00:14:53.178 --> 00:14:54.399 -in the proof of concept area, - -00:14:54.399 --> 00:14:57.433 -and it's ripe for someone to write a - -00:14:57.433 --> 00:14:58.560 -whitepaper about - -00:14:58.560 --> 00:15:00.240 -when to prefer these things. - -00:15:04.800 --> 00:15:08.000 -The merge alist... - -00:15:08.000 --> 00:15:12.959 -Same work here. -Let's get down to business. - -00:15:12.959 --> 00:15:14.667 -This function has quite a... - -00:15:14.667 --> 00:15:17.467 -This macro has quite a doc string. - -00:15:17.467 --> 00:15:20.720 -I think I mentioned earlier -that I got myself into - -00:15:20.720 --> 00:15:22.088 -trouble with the keyword properties. - -00:15:22.088 --> 00:15:23.519 -You can see that we have - -00:15:23.519 --> 00:15:27.359 -not only quite a number of them, - -00:15:27.359 --> 00:15:31.155 -but a lot of default values, - -00:15:31.155 --> 00:15:35.446 -many of which may be relying on - -00:15:35.446 --> 00:15:37.264 -the values that are passed in here. - -00:15:37.264 --> 00:15:40.000 -This is complicated. As it turns out, - -00:15:40.000 --> 00:15:44.000 -I wasn't brave enough in most cases - -00:15:44.000 --> 00:15:45.485 -to try to write a lambda - -00:15:45.485 --> 00:15:47.279 -that could understand and - -00:15:47.279 --> 00:15:49.300 -replace its own local variable. - -00:15:49.300 --> 00:15:50.399 -I just didn't... - -00:15:50.399 --> 00:15:53.519 -It didn't save me enough time. This was - -00:15:53.519 --> 00:15:56.532 -really easy to read and write and -understand - -00:15:56.532 --> 00:15:58.240 -as I thought through my problem, - -00:15:58.240 --> 00:16:00.000 -but now, as I use it, - -00:16:00.000 --> 00:16:02.486 -I've lost a little ground with -this. - -00:16:02.486 --> 00:16:04.079 -I'm not even sure - -00:16:04.079 --> 00:16:06.453 -I like what I got from - -00:16:06.453 --> 00:16:09.341 -the many keyword properties -when it... - -00:16:09.341 --> 00:16:11.920 -And we can look, perhaps if we have - -00:16:11.920 --> 00:16:17.340 -the time, at what that looks like in - -00:16:19.920 --> 00:16:22.720 -Oh, all right, I have to separately - -00:16:22.720 --> 00:16:24.480 -dismiss and restart that. - -00:16:24.480 --> 00:16:27.519 -So that's just about my time. - -00:16:27.519 --> 00:16:29.600 -Being respectful of that, I want - -00:16:29.600 --> 00:16:31.920 -to invite presenters to just jump in at - -00:16:31.920 --> 00:16:35.519 -any of the many large pauses I leave. - -00:16:35.519 --> 00:16:38.079 -I'll just leave up the doc string - -00:16:38.079 --> 00:16:40.160 -for a moment and maybe split the screen - -00:16:40.160 --> 00:16:45.199 -and pull open an item. - -00:16:45.199 --> 00:16:48.720 -([Amin]: Thank you very - -00:16:48.720 --> 00:16:50.720 -much for your talk, Corwin. - -00:16:50.720 --> 00:16:53.839 -I think you still have - -00:16:53.839 --> 00:16:55.027 -maybe three or four more minutes, - -00:16:55.027 --> 00:16:57.680 -if you want to quickly wrap up.) - -00:16:57.680 --> 00:17:00.644 -[Corwin:] Okay, so three or four -more minutes - -00:17:00.644 --> 00:17:05.439 -I can easily spend on thank yous. - -00:17:05.439 --> 00:17:07.280 -I might switch to that if there aren't - -00:17:07.280 --> 00:17:08.270 -questions on the pad. - -00:17:10.160 --> 00:17:12.559 -([Amin:] Would you like me to pull up the pad, - -00:17:12.559 --> 00:17:14.079 -or are you looking at it?) - -00:17:14.079 --> 00:17:16.777 -[Corwin:] I am. I bookmarked it. - -00:17:16.777 --> 00:17:30.840 -I am pulling the tab -and I'll bring it in. - -00:17:30.840 --> 00:17:38.799 -Okay. All right. This is the wrong -Etherpad. - -00:17:38.799 --> 00:17:44.480 -Thanks for the link. - -00:17:44.480 --> 00:17:54.880 -All right. So I think I'm -looking for macros. - -00:17:54.880 --> 00:17:57.630 -Okay. Key message. Sure. - -00:17:57.630 --> 00:18:01.679 -So, the key message is that it's - -00:18:01.679 --> 00:18:02.960 -a jungle out there. - -00:18:02.960 --> 00:18:05.912 -Macros, along with any other design, - -00:18:05.912 --> 00:18:08.559 -can leave you in a position - -00:18:08.559 --> 00:18:11.919 -where you have a nice API. I can show - -00:18:11.919 --> 00:18:13.600 -you other examples (you can find them in - -00:18:13.600 --> 00:18:14.960 -the dungeon-mode source) - -00:18:14.960 --> 00:18:18.480 -of many, many other places where I use - -00:18:18.480 --> 00:18:20.820 -this exact same formula, - -00:18:20.820 --> 00:18:23.840 -quickly sketching out -how a character sheet - -00:18:23.840 --> 00:18:26.180 -or another big data set - -00:18:26.180 --> 00:18:28.480 -needs to figure out -what tables are - -00:18:28.480 --> 00:18:29.320 -going to be interesting - -00:18:29.320 --> 00:18:30.720 -from the collection of files, - -00:18:30.720 --> 00:18:33.967 -and then load up the tile set, - -00:18:33.967 --> 00:18:38.880 -and the layout file from that. - -00:18:38.880 --> 00:18:40.542 -And I mean, it works. - -00:18:40.542 --> 00:18:42.677 -The project is moving forward -with this. - -00:18:42.677 --> 00:18:44.799 -I have the flexibility that I need. - -00:18:44.799 --> 00:18:46.559 -But here I am evaling my own code - -00:18:46.559 --> 00:18:48.640 -to make darn sure even if I get - -00:18:48.640 --> 00:18:52.400 -byte-compiled, this macro - -00:18:52.400 --> 00:18:55.440 -does get evaluated in the user's real - -00:18:55.440 --> 00:18:57.684 -run time. Clearly a design fail. - -00:18:57.684 --> 00:18:58.890 -So that would be... - -00:18:58.890 --> 00:19:00.880 -The key point of my talk is to - -00:19:00.880 --> 00:19:05.600 -present this design fail and - -00:19:05.600 --> 00:19:08.320 -thank the community, but especially - -00:19:08.320 --> 00:19:10.942 -wasamasa for some patience. - -00:19:10.942 --> 00:19:13.280 -Let me add at this moment that - -00:19:13.280 --> 00:19:13.333 -he was so frustrated with me. - -00:19:13.333 --> 00:19:17.115 -They were sort of frustrated with me - -00:19:17.115 --> 00:19:20.400 -(I think I didn't qualify pronouns) - -00:19:24.240 --> 00:19:26.287 -with doing this. The first... - -00:19:26.287 --> 00:19:27.985 -This was one of our first -interactions, - -00:19:27.985 --> 00:19:29.919 -and the feedback was, - -00:19:29.919 --> 00:19:34.240 -"Why is this a macro. Full stop." - -00:19:34.240 --> 00:19:36.640 -And that's a great message, actually. - -00:19:36.640 --> 00:19:39.520 -I hope that maybe this -can encourage - -00:19:39.520 --> 00:19:42.720 -further talks across the subject about, - -00:19:42.720 --> 00:19:43.808 -you know, "Hey, wait a minute, - -00:19:43.808 --> 00:19:45.549 -macros are really fantastic," - -00:19:45.549 --> 00:19:47.018 -as I hope I made clear. - -00:19:47.018 --> 00:19:48.559 -You can do a tremendous amount - -00:19:48.559 --> 00:19:51.039 -with them, and we rely on them - -00:19:51.039 --> 00:19:55.200 -for almost all the fun goodies, - -00:19:55.200 --> 00:20:02.159 -from defun, setq... - -00:20:02.159 --> 00:20:04.639 -I want to get to my thank yous. - -00:20:04.639 --> 00:20:18.840 -Let me just peek back at the pad. - -00:20:20.000 --> 00:20:22.080 -Well, that was actually a scratch buffer, - -00:20:22.080 --> 00:20:24.720 -so I'll have to read it cold off -my notes. - -00:20:27.919 --> 00:20:30.320 -But I'll switch to... I'll also... - -00:20:30.320 --> 00:20:31.600 -I'll say a couple of thank-yous if you - -00:20:31.600 --> 00:20:34.320 -don't mind, Amin. - -00:20:34.320 --> 00:20:36.080 -In addition to the big thank you that I - -00:20:36.080 --> 00:20:39.360 -hope was implied by my shout out -to wasamasa, - -00:20:39.360 --> 00:20:42.720 -I also want to thank you, Amin, for - -00:20:42.720 --> 00:20:46.640 -your kindness in extending - -00:20:46.640 --> 00:20:51.360 -to the project as well as to me, the - -00:20:51.360 --> 00:20:54.320 -the chance to present here. - -00:20:54.320 --> 00:20:56.358 -You've also done a lot of great stuff - -00:20:56.358 --> 00:20:59.360 -for our project. Thank you very much for -that. - -00:20:59.360 --> 00:21:03.400 -Sacha Chua (I'll get there), - -00:21:03.400 --> 00:21:15.919 -thank you so much for - -00:21:15.919 --> 00:21:17.200 -the inspiration that you are to our - -00:21:17.200 --> 00:21:18.320 -whole community. - -00:21:18.320 --> 00:21:22.400 -I also want to thank the presenters - -00:21:22.400 --> 00:21:25.600 -for just being so flexible and - -00:21:25.600 --> 00:21:27.600 -nagging back through the whole thing, - -00:21:27.600 --> 00:21:29.120 -and especially to Leo - -00:21:29.120 --> 00:21:32.159 -who has done so much to -drive the show today. - -00:21:32.159 --> 00:21:37.242 -This is a fractious tent at times, - -00:21:37.242 --> 00:21:39.800 -and sometimes it is indeed - -00:21:39.800 --> 00:21:41.360 -a little bit of a circus, - -00:21:41.360 --> 00:21:44.746 -but I am learning so much so fast. - -00:21:44.746 --> 00:21:46.880 -I'm just inspired by how much - -00:21:46.880 --> 00:21:49.333 -Emacs can teach us. - -00:21:49.333 --> 00:21:52.901 -([Amin:] thank you, Corwin, -for your kind words - -00:21:52.901 --> 00:21:54.960 -about me, of course, - -00:21:54.960 --> 00:21:56.000 -about all of us - -00:21:56.000 --> 00:21:58.000 -and the conference... - -00:21:58.000 --> 00:22:02.400 -Indeed, thanks to everyone who's helped, - -00:22:02.400 --> 00:22:04.159 -including the speakers, of course, - -00:22:04.159 --> 00:22:05.840 -without whom EmacsConf really - -00:22:05.840 --> 00:22:08.960 -wouldn't have been a EmacsConf. - -00:22:08.960 --> 00:22:10.640 -It's been a pleasure - -00:22:10.640 --> 00:22:12.366 -knowing you and -working with you, - -00:22:12.366 --> 00:22:15.743 -from afar for the most part - -00:22:15.743 --> 00:22:17.360 -on dungeon-mode, - -00:22:17.360 --> 00:22:19.937 -helping with small things -here and there - -00:22:19.937 --> 00:22:21.796 -but yeah, it's been my pleasure, - -00:22:21.796 --> 00:22:23.840 -and it's great to have you and - -00:22:23.840 --> 00:22:26.582 -everyone else part of the -community, - -00:22:26.582 --> 00:22:29.180 -and for me to be part of the -community. - -00:22:29.180 --> 00:22:30.559 -It's been a lot of fun. - -00:22:30.559 --> 00:22:33.679 -Thank you.) - -00:22:33.679 --> 00:22:35.206 -[Corwin]: It's an honor. - -00:22:35.206 --> 00:22:37.428 -I don't use that word an awful lot - -00:22:37.428 --> 00:22:39.867 -because I sort of smirk at it. - -00:22:39.867 --> 00:22:43.941 -It gets us in a lot of trouble, -honor does, - -00:22:43.941 --> 00:22:46.904 -but this will be a sure time -to use it. - -00:22:46.904 --> 00:22:48.840 -([Amin:] Thank you.) - -00:22:48.840 --> 00:22:51.840 -[Corwin:] Likewise. diff --git a/2020/subtitles/emacsconf-2020--20-omg-macros--corwin-brust.vtt b/2020/subtitles/emacsconf-2020--20-omg-macros--corwin-brust.vtt new file mode 100644 index 00000000..e9ecb9af --- /dev/null +++ b/2020/subtitles/emacsconf-2020--20-omg-macros--corwin-brust.vtt @@ -0,0 +1,1446 @@ +WEBVTT + +00:00:00.480 --> 00:00:02.879 +Good evening again. I think I + +00:00:02.879 --> 00:00:04.319 +have a little time here + +00:00:04.319 --> 00:00:07.359 +to talk about macros. Is there + +00:00:07.359 --> 00:00:09.440 +still room in our +schedule for that, + +00:00:09.440 --> 00:00:11.440 +or should I just jump to some of + +00:00:11.440 --> 00:00:12.559 +my thoughts on the day? + +00:00:12.559 --> 00:00:15.920 +([Amin:] Pretty sure we + +00:00:15.920 --> 00:00:17.039 +have some time.) + +00:00:17.039 --> 00:00:19.039 +[Corwin:] All right. Great. +([Amin:] Yeah, go for it.) + +00:00:19.039 --> 00:00:20.720 +Well, I'll just drive into my + +00:00:20.720 --> 00:00:22.384 +prepared thing here then. + +00:00:22.384 --> 00:00:24.720 +(Amin: yeah, actually, you're +right on time, so...) + +00:00:24.720 --> 00:00:27.664 +[Corwin:] oh what an amazing thing. + +00:00:27.664 --> 00:00:31.199 +I just... You know, I have been +trying to do what I... + +00:00:31.199 --> 00:00:33.040 +I've got a big thank you planned + +00:00:33.040 --> 00:00:36.239 +at the end, but let me just say, + +00:00:36.239 --> 00:00:39.200 +it's been really cool to watch the + +00:00:39.200 --> 00:00:42.160 +way that people work together. + +00:00:42.160 --> 00:00:46.800 +([Amin:] Absolutely. It's... +This whole event today has been + +00:00:46.800 --> 00:00:50.879 +nothing but awesome, and + +00:00:50.879 --> 00:00:53.120 +no little part thanks to all of the help + +00:00:53.120 --> 00:00:56.909 +from all of you guys and everyone. + +00:00:56.909 --> 00:00:59.120 +Yeah, it's awesome. + +00:00:59.120 --> 00:01:03.065 +With that, I'll just shut up +for now. + +00:01:03.065 --> 00:01:04.891 +Take it away, Corwin.) + +00:01:04.891 --> 00:01:06.479 +[Corwin:] Who knows how to make + +00:01:06.479 --> 00:01:09.840 +make that the default in good old smex? + +00:01:09.840 --> 00:01:12.799 +All right. So I'm gonna try to continue + +00:01:12.799 --> 00:01:14.551 +my theme from the previous talk. + +00:01:14.551 --> 00:01:16.393 +I'm a longtime Emacs user, + +00:01:16.393 --> 00:01:20.240 +but I'm a pretty new person + +00:01:20.240 --> 00:01:22.380 +to trying to really understand + +00:01:22.380 --> 00:01:24.960 +what's going on within Emacs and make + +00:01:24.960 --> 00:01:28.240 +my customizations to it--simple for + +00:01:28.240 --> 00:01:30.960 +what I tend to just think of will work. + +00:01:30.960 --> 00:01:33.566 +And maybe that's a nice bow + +00:01:33.566 --> 00:01:36.240 +to put on that earlier talk. + +00:01:40.479 --> 00:01:44.981 +Let's see here now. It's C-x M-i. + +00:01:44.981 --> 00:01:48.159 +That's right. + +00:01:48.159 --> 00:01:52.960 +And let's try that again. Okay, good. + +00:01:52.960 --> 00:01:55.240 +So demoing is fun, + +00:01:55.240 --> 00:01:57.192 +but I will save most of that + +00:01:57.192 --> 00:01:59.759 +for tomorrow where my + +00:01:59.759 --> 00:02:02.750 +dear friend and co-collaborator + +00:02:02.750 --> 00:02:04.799 +in bringing you the dungeon-mode project, + +00:02:04.799 --> 00:02:07.261 +which is sort of the exciting thing + +00:02:07.261 --> 00:02:10.800 +that we hope you'll be interested in, + +00:02:10.800 --> 00:02:15.680 +gets a little more of a reveal. + +00:02:15.680 --> 00:02:19.360 +Tonight, I'll just close saying + +00:02:19.360 --> 00:02:22.640 +a few things about the process of + +00:02:22.640 --> 00:02:25.680 +making it and continuing my theme of +community. + +00:02:25.680 --> 00:02:29.760 +First of all, a specific and upfront +shout out + +00:02:29.760 --> 00:02:33.120 +to tv's wasamasa who + +00:02:33.120 --> 00:02:36.239 +absolutely shaped and guided this + +00:02:36.239 --> 00:02:38.582 +this program. I may have taken out + +00:02:38.582 --> 00:02:39.898 +a slide with your name on it, + +00:02:39.898 --> 00:02:43.599 +but thank you. + +00:02:43.599 --> 00:02:46.479 +So when we think about Emacs macros + +00:02:46.479 --> 00:02:50.239 +and the power that they give us, + +00:02:53.280 --> 00:02:54.720 +I think about them as a really + +00:02:54.720 --> 00:02:56.400 +deep rabbit hole. They confuse + +00:02:56.400 --> 00:03:00.239 +people a lot. And so, to try to center + +00:03:00.239 --> 00:03:02.480 +myself on that, I remember first that + +00:03:03.599 --> 00:03:09.599 +they're going to be talking to us +about code. + +00:03:09.599 --> 00:03:13.519 +Excuse me, I realize I hadn't +set my timer. + +00:03:13.519 --> 00:03:18.000 +Here we are. + +00:03:18.000 --> 00:03:20.543 +So a simple macro syntax is + +00:03:20.543 --> 00:03:22.239 +going to generate + +00:03:22.239 --> 00:03:25.920 +something that is implicitly confusing + +00:03:25.920 --> 00:03:27.657 +to somebody that knows the syntax + +00:03:27.657 --> 00:03:28.988 +of Emacs Lisp well. + +00:03:28.988 --> 00:03:30.785 +We see something like this + +00:03:30.785 --> 00:03:32.784 +and a veteran eye says + +00:03:32.784 --> 00:03:36.239 +"That x isn't quoted. What's going on?" + +00:03:36.239 --> 00:03:39.840 +but it can be hard to miss. + +00:03:39.840 --> 00:03:43.040 +A lot of the functions (as we'll talk + +00:03:43.040 --> 00:03:46.640 +about in a moment) that are built +into Emacs + +00:03:46.640 --> 00:03:48.572 +really are macros, so a lot of + +00:03:48.572 --> 00:03:50.480 +Emacs features work this way. + +00:03:50.480 --> 00:03:53.040 +It might be scary, but we have to look at + +00:03:53.040 --> 00:03:54.640 +it closely if we really want to get + +00:03:54.640 --> 00:03:58.400 +friendly with Emacs. + +00:03:58.400 --> 00:04:01.439 +Let's just jump right into defmacro, + +00:04:01.439 --> 00:04:03.920 +which is our key entry point. + +00:04:04.720 --> 00:04:05.833 +The notes from this talk + +00:04:05.833 --> 00:04:09.420 +include the link to that, + +00:04:09.420 --> 00:04:12.000 +which... Definitely + +00:04:12.000 --> 00:04:14.640 +read through a couple of times. + +00:04:14.640 --> 00:04:16.000 +That may take you through + +00:04:16.000 --> 00:04:19.440 +into the cl-def macro, which adds + +00:04:19.440 --> 00:04:23.440 +the Common Lisp extensions. + +00:04:23.440 --> 00:04:28.080 +Definitely challenging. + +00:04:28.080 --> 00:04:30.560 +I've struggled there, + +00:04:30.560 --> 00:04:31.759 +as we'll take a look at + +00:04:31.759 --> 00:04:34.800 +in a moment. + +00:04:34.800 --> 00:04:36.266 +So I haven't played too much with + +00:04:36.266 --> 00:04:38.320 +cl-maclet. Perhaps success in + +00:04:38.320 --> 00:04:40.804 +in that keyword space + +00:04:40.804 --> 00:04:44.320 +and figuring out what +the right balance is there + +00:04:44.320 --> 00:04:46.000 +will give me the confidence to try + +00:04:46.000 --> 00:04:51.680 +some more lexical macros. + +00:04:51.680 --> 00:04:53.402 +Let me also briefly introduce + +00:04:53.402 --> 00:04:55.134 +the comma (,) and back quote (`). + +00:04:55.134 --> 00:04:57.389 +If you have allowed your eyes + +00:04:57.389 --> 00:04:59.321 +to cross when you see these, + +00:04:59.321 --> 00:05:03.113 +that's not a shameful, +shameful thing. + +00:05:03.113 --> 00:05:06.080 +It's confusing, and we should be + +00:05:06.080 --> 00:05:07.543 +alerting each other + +00:05:07.543 --> 00:05:09.520 +when we stick macros in, + +00:05:09.520 --> 00:05:11.199 +often by putting them in + +00:05:11.199 --> 00:05:12.255 +different library spaces + +00:05:12.255 --> 00:05:14.160 +for complicated projects, + +00:05:14.160 --> 00:05:17.520 +or otherwise warning people + +00:05:17.520 --> 00:05:19.520 +that this is not an interactive function, + +00:05:19.520 --> 00:05:21.919 +even if you get away +with using it like one. + +00:05:22.639 --> 00:05:26.000 +Watch your back. + +00:05:26.000 --> 00:05:32.800 +The manual itself talks about macros + +00:05:32.800 --> 00:05:35.840 +as being a way of evaluating, + +00:05:35.840 --> 00:05:39.993 +as being an evaluator that will take + +00:05:39.993 --> 00:05:42.800 +our Emacs Lisp expression + +00:05:42.800 --> 00:05:44.800 +and the set of forms that + +00:05:44.800 --> 00:05:47.590 +will feed to it our code, + +00:05:48.960 --> 00:05:50.792 +but it also provides us with + +00:05:50.792 --> 00:05:53.467 +this concept of an environment. + +00:05:53.467 --> 00:05:57.027 +That's really where the power +comes in. + +00:05:57.027 --> 00:05:58.240 +Through that, we can have + +00:05:58.240 --> 00:06:00.080 +lexical variables and + +00:06:00.080 --> 00:06:03.199 +think about--bring in some of the + +00:06:03.199 --> 00:06:06.400 +capabilities that + +00:06:06.400 --> 00:06:09.759 +can be harder to reach with + +00:06:09.759 --> 00:06:13.840 +a pure declarative statement that + +00:06:13.840 --> 00:06:21.440 +doesn't allow for top level + +00:06:21.440 --> 00:06:28.639 +asynchronous... Asynchronicity... + +00:06:28.639 --> 00:06:31.950 +I'm gonna basically + +00:06:33.520 --> 00:06:35.577 +ignore the byte-compilation phase + +00:06:35.577 --> 00:06:36.880 +for this talk + +00:06:36.880 --> 00:06:38.463 +in order to have any prayer + +00:06:38.463 --> 00:06:39.919 +of getting through it in the + +00:06:39.919 --> 00:06:43.600 +remaining 9 or 11 minutes or whatever. + +00:06:43.600 --> 00:06:50.441 +But suffice to say, +that's a scary space, + +00:06:50.441 --> 00:06:52.240 +and that's really + +00:06:52.240 --> 00:06:53.800 +the thing that you want to + +00:06:53.800 --> 00:06:55.277 +start learning about + +00:06:55.277 --> 00:06:57.199 +as you think about + +00:06:57.199 --> 00:07:02.160 +taking macros on in earnest. + +00:07:02.160 --> 00:07:05.919 +Coming back to the comma syntax, + +00:07:05.919 --> 00:07:09.759 +then, having given ourselves a + +00:07:09.759 --> 00:07:12.479 +working definition for the Emacs Lisp + +00:07:12.479 --> 00:07:14.479 +runtime environment, then we can say that + +00:07:14.479 --> 00:07:15.840 +macros are going to + +00:07:15.840 --> 00:07:21.120 +inject code back into that stream, + +00:07:21.120 --> 00:07:25.280 +whereas backquote (`) + +00:07:25.280 --> 00:07:28.479 +is going to give code back. + +00:07:28.479 --> 00:07:31.919 +to the stream--or interject, sorry, + +00:07:31.919 --> 00:07:33.632 +it's going to interject + +00:07:33.632 --> 00:07:35.360 +back into the stream. + +00:07:35.360 --> 00:07:39.840 +Sort of an exclamatory "Excuse me, + +00:07:39.840 --> 00:07:46.966 +I'd like to have a value here." +We can take that value + +00:07:46.966 --> 00:07:48.639 +from the environment as it exists + +00:07:48.639 --> 00:07:54.160 +when our macro is evaluated. + +00:07:54.160 --> 00:07:56.003 +Backquote, on the other hand, + +00:07:56.003 --> 00:08:00.560 +takes the result from that + +00:08:00.560 --> 00:08:02.201 +and returns it back to the stream + +00:08:02.201 --> 00:08:03.467 +for evaluation at the + +00:08:03.467 --> 00:08:05.680 +processing level that invoked us. + +00:08:05.680 --> 00:08:08.720 +So in other words, perhaps back up to + +00:08:08.720 --> 00:08:10.960 +a top-level eval expression where our + +00:08:10.960 --> 00:08:16.720 +macro is invoked. + +00:08:20.080 --> 00:08:22.560 +I'm going to briefly bring + +00:08:22.560 --> 00:08:23.759 +you back to the game + +00:08:23.759 --> 00:08:27.120 +for just a moment. + +00:08:30.240 --> 00:08:32.479 +I won't linger on this slide, + +00:08:32.479 --> 00:08:37.039 +but briefly: this is a + +00:08:37.039 --> 00:08:41.615 +role-playing, pen and pencil, + +00:08:41.615 --> 00:08:43.829 +physical dice tradition + +00:08:43.829 --> 00:08:46.320 +that dates back a long time + +00:08:46.320 --> 00:08:48.080 +from a technology perspective. + +00:08:48.080 --> 00:08:50.727 +It's old in the same way + +00:08:50.727 --> 00:08:58.560 +that other tools that I like +are old. + +00:08:58.560 --> 00:09:00.185 +It's simple to understand. + +00:09:00.185 --> 00:09:01.873 +I can communicate a lot with it + +00:09:01.873 --> 00:09:03.952 +with a simple amount of typing + +00:09:03.952 --> 00:09:09.120 +or scribbling something +on a piece of paper. + +00:09:09.120 --> 00:09:13.500 +It has a complicated problem space +of its own. + +00:09:13.500 --> 00:09:15.519 +Again, I don't want to + +00:09:15.519 --> 00:09:18.212 +get too much into the game here, + +00:09:18.212 --> 00:09:20.177 +but in this talk, + +00:09:20.177 --> 00:09:22.590 +for the last five minutes, + +00:09:22.590 --> 00:09:24.751 +I'll focus on the process + +00:09:24.751 --> 00:09:26.640 +that we took to + +00:09:26.640 --> 00:09:29.190 +automate getting data out of + +00:09:29.190 --> 00:09:31.564 +the Org Mode tables +which eventually + +00:09:31.564 --> 00:09:33.855 +(as we'll talk about more +tomorrow) + +00:09:33.855 --> 00:09:36.000 +are used to draw + +00:09:36.000 --> 00:09:39.440 +game maps and other things. + +00:09:39.440 --> 00:09:42.543 +Here I talk about why we did +that. + +00:09:42.543 --> 00:09:45.279 +I'm going to skip briefly past that, + +00:09:45.279 --> 00:09:49.360 +and say instead that at a high level, + +00:09:49.360 --> 00:09:51.440 +it's symbolic informatics. + +00:09:51.440 --> 00:09:53.519 +We're giving a symbolic name + +00:09:53.519 --> 00:09:58.080 +to a tile set, + +00:10:02.000 --> 00:10:04.000 +and then assigning that tile set some + +00:10:04.000 --> 00:10:04.840 +some characteristics + +00:10:04.840 --> 00:10:06.820 +like physical speeds, screen space + +00:10:06.820 --> 00:10:08.399 +(a variable that we might + +00:10:08.399 --> 00:10:12.800 +want to swap in), and so forth. + +00:10:12.800 --> 00:10:15.200 +You know, our project rests heavily on + +00:10:15.200 --> 00:10:21.040 +Org Mode and its +fundamental capabilities. + +00:10:21.040 --> 00:10:24.000 +The code I'm going to show here + +00:10:28.320 --> 00:10:31.360 +is focused around a sticky + +00:10:31.360 --> 00:10:32.380 +problem space in + +00:10:32.380 --> 00:10:33.861 +information technology. + +00:10:33.861 --> 00:10:38.240 +I'm a professional software engineer + +00:10:38.240 --> 00:10:40.362 +turned technology architect. + +00:10:40.362 --> 00:10:43.495 +I support the websites for + +00:10:43.495 --> 00:10:46.533 +a recognizable financial services brand + +00:10:46.533 --> 00:10:48.500 +that I don't identify + +00:10:48.500 --> 00:10:50.720 +just so I don't accidentally end up + +00:10:50.720 --> 00:10:54.399 +inadvertently misrepresenting my firm + +00:10:54.399 --> 00:10:56.456 +in some financial perspective + +00:10:56.456 --> 00:10:57.760 +if I let some other + +00:10:57.760 --> 00:11:03.300 +companies' name slip, or my own. + +00:11:03.300 --> 00:11:07.700 +It's certainly no representation + +00:11:07.700 --> 00:11:11.279 +of an opinion other than my own. + +00:11:18.800 --> 00:11:22.720 +So ETL has to do with moving data around. + +00:11:22.720 --> 00:11:26.240 +We have the idea of + +00:11:26.240 --> 00:11:29.200 +a pipeline where we'll be able to verify + +00:11:29.200 --> 00:11:30.560 +certain assumptions, + +00:11:30.560 --> 00:11:32.106 +nominally about data quality, + +00:11:32.106 --> 00:11:33.600 +but it could be about anything. + +00:11:33.600 --> 00:11:35.630 +Before the pipeline starts, okay, + +00:11:35.630 --> 00:11:36.886 +we've got a state where we think + +00:11:36.886 --> 00:11:38.560 +it should work if we run it. + +00:11:38.560 --> 00:11:41.920 +We have some extraction where we'll + +00:11:41.920 --> 00:11:43.973 +get our sources, and we may have + +00:11:43.973 --> 00:11:45.040 +the opportunity to + +00:11:45.040 --> 00:11:47.327 +make some assertions there. + +00:11:47.327 --> 00:11:50.510 +In the transform stage, +as well as the load, + +00:11:50.510 --> 00:11:52.720 +things get a little dicer, + +00:11:52.720 --> 00:11:54.079 +to the point where we come out of the + +00:11:54.079 --> 00:11:55.360 +load stage and we should have some + +00:11:55.360 --> 00:11:56.676 +really solid assertions again + +00:11:56.676 --> 00:11:57.724 +that we can even go back + +00:11:57.724 --> 00:11:59.680 +and compare to the extract stage. + +00:11:59.680 --> 00:12:02.639 +From this, we have the rudimentaries + +00:12:02.639 --> 00:12:04.959 +of a data quality practice. + +00:12:04.959 --> 00:12:08.120 +In this case, we have a number of + +00:12:08.120 --> 00:12:09.360 +Org Mode files that will all + +00:12:09.360 --> 00:12:12.639 +be distributed across a + +00:12:12.639 --> 00:12:16.720 +number of players' computers, + +00:12:16.720 --> 00:12:18.959 +so we might not want to update every + +00:12:18.959 --> 00:12:20.320 +part of every buffer. + +00:12:20.320 --> 00:12:22.720 +I think it's a complicated problem space. + +00:12:22.720 --> 00:12:24.560 +So we tried to take + +00:12:24.560 --> 00:12:27.839 +a long-term view of + +00:12:27.839 --> 00:12:30.321 +the solution that we needed. + +00:12:30.321 --> 00:12:32.160 +So I'll go ahead + +00:12:32.160 --> 00:12:36.279 +and open up the function +that... + +00:12:36.279 --> 00:12:39.020 +Let's actually start with the one + +00:12:39.020 --> 00:12:41.680 +that's pretty easy to read. + +00:12:41.680 --> 00:12:46.800 +I'm gonna go ahead and +just crank it up huge, + +00:12:46.800 --> 00:12:51.680 +in case anybody's watching in 480. + +00:12:51.680 --> 00:12:57.733 +This program is not a work of art + +00:12:57.733 --> 00:13:01.120 +It's a simple implementation +of the idea that + +00:13:01.120 --> 00:13:04.000 +an alist of functions + +00:13:04.000 --> 00:13:06.633 +that return maybe some data, + +00:13:06.633 --> 00:13:10.399 +maybe some data and an entry +back into that alist, + +00:13:10.399 --> 00:13:13.040 +can be done quite extensively with + +00:13:13.040 --> 00:13:15.680 +very few lines of code. + +00:13:15.680 --> 00:13:17.586 +Neither is it an especially tight + +00:13:17.586 --> 00:13:19.600 +or thrifty implementation. + +00:13:19.600 --> 00:13:22.000 +It's just trying to get the job done + +00:13:22.000 --> 00:13:25.056 +with a doc statement for everything. + +00:13:25.056 --> 00:13:28.595 +At the heart, we see a call to + +00:13:28.595 --> 00:13:32.067 +this macro called dm-coalesce-hash, + +00:13:32.067 --> 00:13:33.714 +and that's what I'd like +to focus in on. + +00:13:33.714 --> 00:13:35.360 +You can see... I think + +00:13:35.360 --> 00:13:38.800 +that something unpleasant is +happening here. + +00:13:38.800 --> 00:13:43.991 +I've got an eval in what is... + +00:13:43.991 --> 00:13:49.519 +I will share a fairly central function + +00:13:49.519 --> 00:13:52.160 +that those implementing +this ETL pattern are + +00:13:52.160 --> 00:13:54.933 +welcome to derive from. + +00:13:54.933 --> 00:13:57.680 +That is, this is a +default transform + +00:13:57.680 --> 00:14:00.959 +that you can get when loading +certain kinds of + +00:14:00.959 --> 00:14:04.560 +org-mode tables that have been + +00:14:04.560 --> 00:14:06.399 +properly adorned. Again, we'll get + +00:14:06.399 --> 00:14:09.120 +into that all tomorrow. + +00:14:09.120 --> 00:14:11.900 +So, keeping an eye on time. +Couple minutes left. + +00:14:11.900 --> 00:14:13.760 +Let's look at the macro itself. + +00:14:13.760 --> 00:14:15.000 +I have a slide on this, + +00:14:15.000 --> 00:14:24.639 +but let's go ahead +and risk getting off page. + +00:14:24.639 --> 00:14:27.199 +Oh boy. Here we go. So this is my + +00:14:27.199 --> 00:14:28.959 +utilities bucket. + +00:14:28.959 --> 00:14:31.920 +It has such basic features as "give me a + +00:14:31.920 --> 00:14:34.000 +hash table with some defaults, I'll think + +00:14:34.000 --> 00:14:36.000 +about that later," + +00:14:36.000 --> 00:14:44.720 +and "add to list," a special version + +00:14:44.720 --> 00:14:47.600 +that enables us to be a little cavalier + +00:14:47.600 --> 00:14:49.360 +in experimenting with alist versus + +00:14:49.360 --> 00:14:50.967 +hashes versus plists. + +00:14:50.967 --> 00:14:53.178 +We've made a right mess for +ourselves + +00:14:53.178 --> 00:14:54.399 +in the proof of concept area, + +00:14:54.399 --> 00:14:57.433 +and it's ripe for someone to write a + +00:14:57.433 --> 00:14:58.560 +whitepaper about + +00:14:58.560 --> 00:15:00.240 +when to prefer these things. + +00:15:04.800 --> 00:15:08.000 +The merge alist... + +00:15:08.000 --> 00:15:12.959 +Same work here. +Let's get down to business. + +00:15:12.959 --> 00:15:14.667 +This function has quite a... + +00:15:14.667 --> 00:15:17.467 +This macro has quite a doc string. + +00:15:17.467 --> 00:15:20.720 +I think I mentioned earlier +that I got myself into + +00:15:20.720 --> 00:15:22.088 +trouble with the keyword properties. + +00:15:22.088 --> 00:15:23.519 +You can see that we have + +00:15:23.519 --> 00:15:27.359 +not only quite a number of them, + +00:15:27.359 --> 00:15:31.155 +but a lot of default values, + +00:15:31.155 --> 00:15:35.446 +many of which may be relying on + +00:15:35.446 --> 00:15:37.264 +the values that are passed in here. + +00:15:37.264 --> 00:15:40.000 +This is complicated. As it turns out, + +00:15:40.000 --> 00:15:44.000 +I wasn't brave enough in most cases + +00:15:44.000 --> 00:15:45.485 +to try to write a lambda + +00:15:45.485 --> 00:15:47.279 +that could understand and + +00:15:47.279 --> 00:15:49.300 +replace its own local variable. + +00:15:49.300 --> 00:15:50.399 +I just didn't... + +00:15:50.399 --> 00:15:53.519 +It didn't save me enough time. This was + +00:15:53.519 --> 00:15:56.532 +really easy to read and write and +understand + +00:15:56.532 --> 00:15:58.240 +as I thought through my problem, + +00:15:58.240 --> 00:16:00.000 +but now, as I use it, + +00:16:00.000 --> 00:16:02.486 +I've lost a little ground with +this. + +00:16:02.486 --> 00:16:04.079 +I'm not even sure + +00:16:04.079 --> 00:16:06.453 +I like what I got from + +00:16:06.453 --> 00:16:09.341 +the many keyword properties +when it... + +00:16:09.341 --> 00:16:11.920 +And we can look, perhaps if we have + +00:16:11.920 --> 00:16:17.340 +the time, at what that looks like in + +00:16:19.920 --> 00:16:22.720 +Oh, all right, I have to separately + +00:16:22.720 --> 00:16:24.480 +dismiss and restart that. + +00:16:24.480 --> 00:16:27.519 +So that's just about my time. + +00:16:27.519 --> 00:16:29.600 +Being respectful of that, I want + +00:16:29.600 --> 00:16:31.920 +to invite presenters to just jump in at + +00:16:31.920 --> 00:16:35.519 +any of the many large pauses I leave. + +00:16:35.519 --> 00:16:38.079 +I'll just leave up the doc string + +00:16:38.079 --> 00:16:40.160 +for a moment and maybe split the screen + +00:16:40.160 --> 00:16:45.199 +and pull open an item. + +00:16:45.199 --> 00:16:48.720 +([Amin]: Thank you very + +00:16:48.720 --> 00:16:50.720 +much for your talk, Corwin. + +00:16:50.720 --> 00:16:53.839 +I think you still have + +00:16:53.839 --> 00:16:55.027 +maybe three or four more minutes, + +00:16:55.027 --> 00:16:57.680 +if you want to quickly wrap up.) + +00:16:57.680 --> 00:17:00.644 +[Corwin:] Okay, so three or four +more minutes + +00:17:00.644 --> 00:17:05.439 +I can easily spend on thank yous. + +00:17:05.439 --> 00:17:07.280 +I might switch to that if there aren't + +00:17:07.280 --> 00:17:08.270 +questions on the pad. + +00:17:10.160 --> 00:17:12.559 +([Amin:] Would you like me to pull up the pad, + +00:17:12.559 --> 00:17:14.079 +or are you looking at it?) + +00:17:14.079 --> 00:17:16.777 +[Corwin:] I am. I bookmarked it. + +00:17:16.777 --> 00:17:30.840 +I am pulling the tab +and I'll bring it in. + +00:17:30.840 --> 00:17:38.799 +Okay. All right. This is the wrong +Etherpad. + +00:17:38.799 --> 00:17:44.480 +Thanks for the link. + +00:17:44.480 --> 00:17:54.880 +All right. So I think I'm +looking for macros. + +00:17:54.880 --> 00:17:57.630 +Okay. Key message. Sure. + +00:17:57.630 --> 00:18:01.679 +So, the key message is that it's + +00:18:01.679 --> 00:18:02.960 +a jungle out there. + +00:18:02.960 --> 00:18:05.912 +Macros, along with any other design, + +00:18:05.912 --> 00:18:08.559 +can leave you in a position + +00:18:08.559 --> 00:18:11.919 +where you have a nice API. I can show + +00:18:11.919 --> 00:18:13.600 +you other examples (you can find them in + +00:18:13.600 --> 00:18:14.960 +the dungeon-mode source) + +00:18:14.960 --> 00:18:18.480 +of many, many other places where I use + +00:18:18.480 --> 00:18:20.820 +this exact same formula, + +00:18:20.820 --> 00:18:23.840 +quickly sketching out +how a character sheet + +00:18:23.840 --> 00:18:26.180 +or another big data set + +00:18:26.180 --> 00:18:28.480 +needs to figure out +what tables are + +00:18:28.480 --> 00:18:29.320 +going to be interesting + +00:18:29.320 --> 00:18:30.720 +from the collection of files, + +00:18:30.720 --> 00:18:33.967 +and then load up the tile set, + +00:18:33.967 --> 00:18:38.880 +and the layout file from that. + +00:18:38.880 --> 00:18:40.542 +And I mean, it works. + +00:18:40.542 --> 00:18:42.677 +The project is moving forward +with this. + +00:18:42.677 --> 00:18:44.799 +I have the flexibility that I need. + +00:18:44.799 --> 00:18:46.559 +But here I am evaling my own code + +00:18:46.559 --> 00:18:48.640 +to make darn sure even if I get + +00:18:48.640 --> 00:18:52.400 +byte-compiled, this macro + +00:18:52.400 --> 00:18:55.440 +does get evaluated in the user's real + +00:18:55.440 --> 00:18:57.684 +run time. Clearly a design fail. + +00:18:57.684 --> 00:18:58.890 +So that would be... + +00:18:58.890 --> 00:19:00.880 +The key point of my talk is to + +00:19:00.880 --> 00:19:05.600 +present this design fail and + +00:19:05.600 --> 00:19:08.320 +thank the community, but especially + +00:19:08.320 --> 00:19:10.942 +wasamasa for some patience. + +00:19:10.942 --> 00:19:13.280 +Let me add at this moment that + +00:19:13.280 --> 00:19:13.333 +he was so frustrated with me. + +00:19:13.333 --> 00:19:17.115 +They were sort of frustrated with me + +00:19:17.115 --> 00:19:20.400 +(I think I didn't qualify pronouns) + +00:19:24.240 --> 00:19:26.287 +with doing this. The first... + +00:19:26.287 --> 00:19:27.985 +This was one of our first +interactions, + +00:19:27.985 --> 00:19:29.919 +and the feedback was, + +00:19:29.919 --> 00:19:34.240 +"Why is this a macro. Full stop." + +00:19:34.240 --> 00:19:36.640 +And that's a great message, actually. + +00:19:36.640 --> 00:19:39.520 +I hope that maybe this +can encourage + +00:19:39.520 --> 00:19:42.720 +further talks across the subject about, + +00:19:42.720 --> 00:19:43.808 +you know, "Hey, wait a minute, + +00:19:43.808 --> 00:19:45.549 +macros are really fantastic," + +00:19:45.549 --> 00:19:47.018 +as I hope I made clear. + +00:19:47.018 --> 00:19:48.559 +You can do a tremendous amount + +00:19:48.559 --> 00:19:51.039 +with them, and we rely on them + +00:19:51.039 --> 00:19:55.200 +for almost all the fun goodies, + +00:19:55.200 --> 00:20:02.159 +from defun, setq... + +00:20:02.159 --> 00:20:04.639 +I want to get to my thank yous. + +00:20:04.639 --> 00:20:18.840 +Let me just peek back at the pad. + +00:20:20.000 --> 00:20:22.080 +Well, that was actually a scratch buffer, + +00:20:22.080 --> 00:20:24.720 +so I'll have to read it cold off +my notes. + +00:20:27.919 --> 00:20:30.320 +But I'll switch to... I'll also... + +00:20:30.320 --> 00:20:31.600 +I'll say a couple of thank-yous if you + +00:20:31.600 --> 00:20:34.320 +don't mind, Amin. + +00:20:34.320 --> 00:20:36.080 +In addition to the big thank you that I + +00:20:36.080 --> 00:20:39.360 +hope was implied by my shout out +to wasamasa, + +00:20:39.360 --> 00:20:42.720 +I also want to thank you, Amin, for + +00:20:42.720 --> 00:20:46.640 +your kindness in extending + +00:20:46.640 --> 00:20:51.360 +to the project as well as to me, the + +00:20:51.360 --> 00:20:54.320 +the chance to present here. + +00:20:54.320 --> 00:20:56.358 +You've also done a lot of great stuff + +00:20:56.358 --> 00:20:59.360 +for our project. Thank you very much for +that. + +00:20:59.360 --> 00:21:03.400 +Sacha Chua (I'll get there), + +00:21:03.400 --> 00:21:15.919 +thank you so much for + +00:21:15.919 --> 00:21:17.200 +the inspiration that you are to our + +00:21:17.200 --> 00:21:18.320 +whole community. + +00:21:18.320 --> 00:21:22.400 +I also want to thank the presenters + +00:21:22.400 --> 00:21:25.600 +for just being so flexible and + +00:21:25.600 --> 00:21:27.600 +nagging back through the whole thing, + +00:21:27.600 --> 00:21:29.120 +and especially to Leo + +00:21:29.120 --> 00:21:32.159 +who has done so much to +drive the show today. + +00:21:32.159 --> 00:21:37.242 +This is a fractious tent at times, + +00:21:37.242 --> 00:21:39.800 +and sometimes it is indeed + +00:21:39.800 --> 00:21:41.360 +a little bit of a circus, + +00:21:41.360 --> 00:21:44.746 +but I am learning so much so fast. + +00:21:44.746 --> 00:21:46.880 +I'm just inspired by how much + +00:21:46.880 --> 00:21:49.333 +Emacs can teach us. + +00:21:49.333 --> 00:21:52.901 +([Amin:] thank you, Corwin, +for your kind words + +00:21:52.901 --> 00:21:54.960 +about me, of course, + +00:21:54.960 --> 00:21:56.000 +about all of us + +00:21:56.000 --> 00:21:58.000 +and the conference... + +00:21:58.000 --> 00:22:02.400 +Indeed, thanks to everyone who's helped, + +00:22:02.400 --> 00:22:04.159 +including the speakers, of course, + +00:22:04.159 --> 00:22:05.840 +without whom EmacsConf really + +00:22:05.840 --> 00:22:08.960 +wouldn't have been a EmacsConf. + +00:22:08.960 --> 00:22:10.640 +It's been a pleasure + +00:22:10.640 --> 00:22:12.366 +knowing you and +working with you, + +00:22:12.366 --> 00:22:15.743 +from afar for the most part + +00:22:15.743 --> 00:22:17.360 +on dungeon-mode, + +00:22:17.360 --> 00:22:19.937 +helping with small things +here and there + +00:22:19.937 --> 00:22:21.796 +but yeah, it's been my pleasure, + +00:22:21.796 --> 00:22:23.840 +and it's great to have you and + +00:22:23.840 --> 00:22:26.582 +everyone else part of the +community, + +00:22:26.582 --> 00:22:29.180 +and for me to be part of the +community. + +00:22:29.180 --> 00:22:30.559 +It's been a lot of fun. + +00:22:30.559 --> 00:22:33.679 +Thank you.) + +00:22:33.679 --> 00:22:35.206 +[Corwin]: It's an honor. + +00:22:35.206 --> 00:22:37.428 +I don't use that word an awful lot + +00:22:37.428 --> 00:22:39.867 +because I sort of smirk at it. + +00:22:39.867 --> 00:22:43.941 +It gets us in a lot of trouble, +honor does, + +00:22:43.941 --> 00:22:46.904 +but this will be a sure time +to use it. + +00:22:46.904 --> 00:22:48.840 +([Amin:] Thank you.) + +00:22:48.840 --> 00:22:51.840 +[Corwin:] Likewise. -- cgit v1.2.3