1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
|
WEBVTT
Kind: captions
Language: en-GB
00:00:54.000 --> 00:00:55.000
00:00:55.000 --> 00:00:57.000
Hi! My name is Eduardo Ochs. I'm the
00:00:57.000 --> 00:01:00.000
author of an Emacs package called eev and
00:01:00.000 --> 00:01:03.000
the title of this video is
00:01:03.000 --> 00:01:05.000
"Some problems of modernizing Emacs".
00:01:05.000 --> 00:01:08.000
Here is a summary of the main themes
00:01:08.000 --> 00:01:10.000
of this video. I'm going to talk mainly
00:01:10.000 --> 00:01:12.000
about these four things here. The first
00:01:12.000 --> 00:01:15.000
one is that Emacs has changed a lot in its
00:01:15.000 --> 00:01:18.000
recent versions, and now it has lots of
00:01:18.000 --> 00:01:21.000
types... so if we want to look under the
00:01:21.000 --> 00:01:24.000
hood and to understand what Emacs
00:01:24.000 --> 00:01:27.000
really does we are going to stumble on
00:01:27.000 --> 00:01:30.000
lots of types... and the
00:01:30.000 --> 00:01:34.000
current tree of classes and types
00:01:34.000 --> 00:01:37.000
looks like this... that is,
00:01:37.000 --> 00:01:46.000
is quite big.
00:01:46.000 --> 00:01:49.000
The second theme is that people used
00:01:49.000 --> 00:01:53.000
to say things like "Anyone can learn Lisp
00:01:53.000 --> 00:01:56.000
in one day"... I'm going to explain
00:01:56.000 --> 00:02:01.000
this quote, and I'm also going to show
00:02:01.000 --> 00:02:04.000
that now this is gone... anyway. This is a
00:02:04.000 --> 00:02:08.000
very short summary... details soon.
00:02:08.000 --> 00:02:10.000
I will also show how to display
00:02:10.000 --> 00:02:13.000
better "inner views" of Emacs objects...
00:02:13.000 --> 00:02:16.000
I'm going to Define what is an inner view,
00:02:16.000 --> 00:02:18.000
of course.
00:02:18.000 --> 00:02:20.000
The main trick is that we are going
00:02:20.000 --> 00:02:24.000
to use one of the ways of displaying
00:02:24.000 --> 00:02:29.000
internal objects, that is the `cl-print'
00:02:29.000 --> 00:02:32.000
family of functions, for example,
00:02:32.000 --> 00:02:35.000
`cl-prin1-to-string', and here are some
00:02:35.000 --> 00:02:37.000
examples of the kind of output that we
00:02:37.000 --> 00:02:38.000
are going to see...
00:02:38.000 --> 00:02:44.000
for example, if we run these two lines
00:02:44.000 --> 00:02:47.000
here the first line defines a function `foo'
00:02:47.000 --> 00:02:52.000
and the second line sets `o' to the
00:02:52.000 --> 00:02:54.000
internal view of the definition of `foo'.
00:02:54.000 --> 00:02:59.000
In older Emacses `o' would be just a
00:02:59.000 --> 00:03:02.000
list that looks... that would look very
00:03:02.000 --> 00:03:05.000
similar to this line here... but in newer
00:03:05.000 --> 00:03:09.000
Emacses the result of this - I mean, the
00:03:09.000 --> 00:03:12.000
the contents of `o' is this thing here,
00:03:12.000 --> 00:03:15.000
that looks quite different
00:03:15.000 --> 00:03:18.000
from this definition.
00:03:18.000 --> 00:03:21.000
So, in older Emacses
00:03:21.000 --> 00:03:25.000
the contents of the
00:03:25.000 --> 00:03:28.000
function cell of `o'...
00:03:28.000 --> 00:03:30.000
sorry, of the function cell of `foo',
00:03:30.000 --> 00:03:32.000
would be an "old-style lambda",
00:03:32.000 --> 00:03:35.000
that would be just a list like this...
00:03:35.000 --> 00:03:39.000
and in newer Emacses uh the contents of O would
00:03:39.000 --> 00:03:42.000
be a "vector-like lambda"... look for the
00:03:42.000 --> 00:03:44.000
square brackets here - this is a
00:03:44.000 --> 00:03:47.000
vector, but it is preceded by a hash sign.
00:03:47.000 --> 00:03:49.000
So this is what we call
00:03:49.000 --> 00:03:51.000
a "vector-like lambda",
00:03:51.000 --> 00:03:53.000
and vector-like lambas do not
00:03:53.000 --> 00:03:55.000
have a canonical printed representation -
00:03:55.000 --> 00:03:57.000
they have at least two semicanonical
00:03:57.000 --> 00:03:59.000
printed representations...
00:03:59.000 --> 00:04:01.000
The first semicanonical
00:04:01.000 --> 00:04:04.000
printed representation is this one, that is
00:04:04.000 --> 00:04:07.000
generated by a family of functions with
00:04:07.000 --> 00:04:09.000
names like `prin1'...
00:04:09.000 --> 00:04:13.000
and the second semicanonical printed
00:04:13.000 --> 00:04:17.000
representation is like this -
00:04:17.000 --> 00:04:20.000
it looks like a list...
00:04:20.000 --> 00:04:23.000
it looks somewhat like this definition
00:04:23.000 --> 00:04:27.000
of `foo' here, but it has this
00:04:27.000 --> 00:04:29.000
`:dynbind' symbol here...
00:04:29.000 --> 00:04:32.000
and it turns out that when we use
00:04:32.000 --> 00:04:35.000
the `cl-print' family of functions we can
00:04:35.000 --> 00:04:37.000
reconfigure how things are printed...
00:04:37.000 --> 00:04:40.000
and I'm going to show several interesting
00:04:40.000 --> 00:04:47.000
ways of reconfiguring how lambdas are printed,
00:04:47.000 --> 00:04:49.000
and one of the ways is going to
00:04:49.000 --> 00:04:52.000
be like this.
00:04:52.000 --> 00:04:56.000
We can also use the `cl-print'
00:04:56.000 --> 00:04:59.000
functions with my indentation tricks to
00:04:59.000 --> 00:05:04.000
to display how types, or classes, are
00:05:04.000 --> 00:05:07.000
viewed internally by Emacs, and this is a
00:05:07.000 --> 00:05:10.000
big example...
00:05:10.000 --> 00:05:14.000
This is what Emacs considers as being
00:05:14.000 --> 00:05:16.000
the definition of the type
00:05:16.000 --> 00:05:18.000
`cl-structure-class',
00:05:18.000 --> 00:05:21.000
class and it is this big thing here.
00:05:21.000 --> 00:05:24.000
I edited it very lightly...
00:05:24.000 --> 00:05:30.000
I just uh deleted some line breaks here.
00:05:30.000 --> 00:05:33.000
And another thing that I want to to
00:05:33.000 --> 00:05:35.000
explain is that Emacs
00:05:35.000 --> 00:05:37.000
has some help functions that
00:05:37.000 --> 00:05:39.000
I have never liked...
00:05:39.000 --> 00:05:41.000
for most people they are good enough,
00:05:41.000 --> 00:05:44.000
but for me they aren't... they...
00:05:44.000 --> 00:05:48.000
uh, well - I'm going to say
00:05:48.000 --> 00:05:50.000
more about this later...
00:05:50.000 --> 00:05:52.000
and, for example,
00:05:52.000 --> 00:05:54.000
if we want a description of what is
00:05:54.000 --> 00:05:58.000
this type here, that we just saw in
00:05:58.000 --> 00:06:00.000
its internal view here...
00:06:00.000 --> 00:06:02.000
we can run either `describe-type'
00:06:02.000 --> 00:06:04.000
or my variant of `describe-type',
00:06:04.000 --> 00:06:07.000
and we get a help buffer
00:06:07.000 --> 00:06:10.000
that looks like this, in which
00:06:10.000 --> 00:06:13.000
these blue things that are underlined
00:06:13.000 --> 00:06:15.000
are "buttons", in the classical sense...
00:06:15.000 --> 00:06:17.000
you can click on these buttons, or type
00:06:17.000 --> 00:06:19.000
RET on these buttons, and you will be
00:06:19.000 --> 00:06:22.000
taken to another help page, that is
00:06:22.000 --> 00:06:24.000
generated dynamically...
00:06:24.000 --> 00:06:28.000
and you can navigate back and forth...
00:06:28.000 --> 00:06:30.000
and well, whatever...
00:06:30.000 --> 00:06:33.000
and I'm going to explain my
00:06:33.000 --> 00:06:35.000
problems with these kinds of help buffers
00:06:35.000 --> 00:06:37.000
and what I'm trying to do to
00:06:37.000 --> 00:06:41.000
overcome these problems...
00:06:41.000 --> 00:06:43.000
One of my slogans in this video
00:06:43.000 --> 00:06:43.000
is going to be this one:
00:06:43.000 --> 00:06:45.000
"Anyone can learn Lisp in one day".
00:06:45.000 --> 00:06:49.000
this is a part of a bigger quote
00:06:49.000 --> 00:06:51.000
that I took from a keynote presentation
00:06:51.000 --> 00:06:54.000
by Abelson and Sussman, who
00:06:54.000 --> 00:06:58.000
are two dinosaurs of Computer Science...
00:06:58.000 --> 00:07:00.000
Here is the full quote:
00:07:00.000 --> 00:07:04.000
"Anyone can learn Lisp in one day -
00:07:04.000 --> 00:07:06.000
except that if they already know Fortran
00:07:06.000 --> 00:07:11.000
then it would take three days."
00:07:11.000 --> 00:07:24.000
This is a frame of the video...
00:07:24.000 --> 00:07:28.000
By the way I am going to to add
00:07:28.000 --> 00:07:32.000
this... "and if the person is starting
00:07:32.000 --> 00:07:34.000
with Doom Emacs then it would take 5 years."
00:07:34.000 --> 00:07:39.000
why? I'm going to explain why.
00:07:39.000 --> 00:07:43.000
This is how Emacs used to be.
00:07:43.000 --> 00:07:46.000
If we execute these two expressions here
00:07:46.000 --> 00:07:51.000
the first one... sorry, each symbol can
00:07:51.000 --> 00:07:53.000
have two "values",
00:07:53.000 --> 00:07:54.000
one is its "value as a variable"
00:07:54.000 --> 00:07:58.000
and another one is its "value as a function"...
00:07:58.000 --> 00:08:02.000
and if we run this we store 42
00:08:02.000 --> 00:08:07.000
in the "value cell" of the symbol `foo', and
00:08:07.000 --> 00:08:11.000
if we run this defun here it stores a
00:08:11.000 --> 00:08:14.000
certain anonymous function in the
00:08:14.000 --> 00:08:18.000
"function cell" of the symbol `foo'...
00:08:18.000 --> 00:08:22.000
and in Emacs, until some time ago
00:08:22.000 --> 00:08:27.000
if we did that and and if we ran
00:08:27.000 --> 00:08:30.000
this expression here the result
00:08:30.000 --> 00:08:31.000
would be 42,
00:08:31.000 --> 00:08:35.000
because of this line here, and if we
00:08:35.000 --> 00:08:37.000
ran this line here the result would be
00:08:37.000 --> 00:08:40.000
the anonymous function corresponding to
00:08:40.000 --> 00:08:41.000
this defun here...
00:08:41.000 --> 00:08:45.000
but now this has changed...
00:08:45.000 --> 00:08:48.000
the result of this thing here is this
00:08:48.000 --> 00:08:51.000
vector-like lambda here - but that doesn't
00:08:51.000 --> 00:08:54.000
matter much now...
00:08:54.000 --> 00:08:56.000
So, until some time ago
00:08:56.000 --> 00:08:58.000
if we did that and if we ran
00:08:58.000 --> 00:09:01.000
this expression here, (foo foo)...
00:09:01.000 --> 00:09:04.000
Emacs would do this: it would
00:09:04.000 --> 00:09:06.000
replace the first `foo' by this
00:09:06.000 --> 00:09:09.000
anonymous function here, it would replace
00:09:09.000 --> 00:09:11.000
the second `foo' by the value of `foo' as a
00:09:11.000 --> 00:09:13.000
variable, that is 42,
00:09:13.000 --> 00:09:16.000
and it would evaluate this, and the
00:09:16.000 --> 00:09:20.000
result would be 420.
00:09:20.000 --> 00:09:23.000
So, again, we used to have this slogan
00:09:23.000 --> 00:09:26.000
here, "anyone can learn Lisp in one day"...
00:09:26.000 --> 00:09:28.000
but now this is gone.
00:09:28.000 --> 00:09:30.000
Let me show... let me talk
00:09:30.000 --> 00:09:34.000
a bit more about why...
00:09:34.000 --> 00:09:36.000
the title of this slide is
00:09:36.000 --> 00:09:38.000
"Lambdas for beginners broken"...
00:09:38.000 --> 00:09:41.000
if we run this, as I've shown
00:09:41.000 --> 00:09:43.000
in the previous slide...
00:09:43.000 --> 00:09:45.000
in the old style, in old Emacses,
00:09:45.000 --> 00:09:47.000
the result of (symbol-function 'foo)
00:09:47.000 --> 00:09:49.000
would be this anonymous function here...
00:09:49.000 --> 00:09:54.000
and now we get this strange thing here.
00:09:54.000 --> 00:09:58.000
So, this is an "old-style lambda",
00:09:58.000 --> 00:10:02.000
this is a "vector-like lambda",
00:10:02.000 --> 00:10:05.000
and until the middle of 2024
00:10:05.000 --> 00:10:08.000
beginners could learn a lot of Lisp
00:10:08.000 --> 00:10:11.000
by thinking only in terms of
00:10:11.000 --> 00:10:13.000
objects like these...
00:10:13.000 --> 00:10:15.000
this is a function and this
00:10:15.000 --> 00:10:17.000
is an anonymous function, and
00:10:17.000 --> 00:10:20.000
they would learn how to draw cons cell
00:10:20.000 --> 00:10:23.000
diagrams like this thing here and this
00:10:23.000 --> 00:10:25.000
thing here...
00:10:25.000 --> 00:10:27.000
they would think on lists as
00:10:27.000 --> 00:10:29.000
being these trees here, and they
00:10:29.000 --> 00:10:32.000
would be able to understand a lot of
00:10:32.000 --> 00:10:35.000
Lisp just by thinking in these terms...
00:10:35.000 --> 00:10:39.000
and then vector-like lambdas started
00:10:39.000 --> 00:10:43.000
to appear in many places... and if we use
00:10:43.000 --> 00:10:46.000
"vector-like lambdas" in a wide sense,
00:10:46.000 --> 00:10:50.000
to mean all the new objects,
00:10:50.000 --> 00:10:54.000
these new objects, that are
00:10:54.000 --> 00:10:56.000
difficult to visualize... they also started
00:10:56.000 --> 00:10:58.000
to appear in many places.
00:10:58.000 --> 00:11:01.000
This is a continuation of the
00:11:01.000 --> 00:11:04.000
previous slide - this part here is a copy
00:11:04.000 --> 00:11:06.000
of things that were in the previous slide...
00:11:06.000 --> 00:11:12.000
before 2024 beginners could
00:11:12.000 --> 00:11:17.000
open black boxes like this...
00:11:17.000 --> 00:11:20.000
they could try to see what was in the
00:11:20.000 --> 00:11:24.000
function cell of the symbol `foo'...
00:11:24.000 --> 00:11:27.000
and they would see something elegant and
00:11:27.000 --> 00:11:29.000
mind-blowing... and they would start to love
00:11:29.000 --> 00:11:31.000
Lisp immediately.
00:11:31.000 --> 00:11:33.000
Now what they get - what they see -
00:11:33.000 --> 00:11:35.000
is a tiny part of a very complex structure
00:11:35.000 --> 00:11:39.000
that is very powerful but that is
00:11:39.000 --> 00:11:41.000
very difficult to understand...
00:11:41.000 --> 00:11:44.000
and now our beginners are overwhelmed
00:11:44.000 --> 00:11:46.000
instead of mind-blown.
00:11:46.000 --> 00:11:48.000
Note that I said "black box" here.
00:11:48.000 --> 00:11:52.000
Let me explain the term.
00:11:52.000 --> 00:11:57.000
We can open what's inside of `foo'...
00:11:57.000 --> 00:11:59.000
we can open `foo' to see the contents of
00:11:59.000 --> 00:12:02.000
the symbol `foo', and we can try to see
00:12:02.000 --> 00:12:06.000
what's in the function cell of the
00:12:06.000 --> 00:12:08.000
symbol `foo'...
00:12:08.000 --> 00:12:10.000
so we can open the box, but what we get
00:12:10.000 --> 00:12:13.000
is something very difficult to understand,
00:12:13.000 --> 00:12:17.000
and so I'm going to say that
00:12:17.000 --> 00:12:21.000
when this happens that box is black.
00:12:21.000 --> 00:12:23.000
It is not totally black - we can open open it -
00:12:23.000 --> 00:12:26.000
but we don't understand what is going on there,
00:12:26.000 --> 00:12:30.000
so we declare that that is black.
00:12:30.000 --> 00:12:33.000
And... when these things started to happen
00:12:33.000 --> 00:12:38.000
_I_ was overwhelmed -
00:12:38.000 --> 00:12:40.000
and in this video I'm going to pretend
00:12:40.000 --> 00:12:44.000
that I was not the only person
00:12:44.000 --> 00:12:46.000
that was overwhelmed
00:12:46.000 --> 00:12:50.000
by these new structures
00:12:50.000 --> 00:12:52.000
that are not so elegant
00:12:52.000 --> 00:12:54.000
as the ones that we had before.
00:12:54.000 --> 00:12:56.000
Anyway...
00:12:56.000 --> 00:20:38.000
|