Lightning Talks I - European Lisp SymposiumMeta-Implementation Protocol Semantics + Reflection =...
Transcript of Lightning Talks I - European Lisp SymposiumMeta-Implementation Protocol Semantics + Reflection =...
![Page 1: Lightning Talks I - European Lisp SymposiumMeta-Implementation Protocol Semantics + Reflection = First-Class Implementations Turn your Lisp into a Meta-Platform François-René Rideau,](https://reader030.fdocuments.us/reader030/viewer/2022040820/5e695d46283b583d1048a49f/html5/thumbnails/1.jpg)
Lightning Talks IELS 2017
![Page 2: Lightning Talks I - European Lisp SymposiumMeta-Implementation Protocol Semantics + Reflection = First-Class Implementations Turn your Lisp into a Meta-Platform François-René Rideau,](https://reader030.fdocuments.us/reader030/viewer/2022040820/5e695d46283b583d1048a49f/html5/thumbnails/2.jpg)
• 01. First-Class Implementations - François-René Rideau
• 02. Reflectable CL Functions Using the MOP - Jim newton
• 03. Erlangen: Async Distributed Msg Passing for CCL - Max Rottenkolber
• 04. A CL Grapher for Implications Between Axioms - Ioanna M. Dimitriou
• 05. cl-jupyter: Lisp-Powered Jupyter Notebooks - Frédéric Peschanski
• 06. Trial, a New CL Game Engine - Nicolas Hafner
![Page 3: Lightning Talks I - European Lisp SymposiumMeta-Implementation Protocol Semantics + Reflection = First-Class Implementations Turn your Lisp into a Meta-Platform François-René Rideau,](https://reader030.fdocuments.us/reader030/viewer/2022040820/5e695d46283b583d1048a49f/html5/thumbnails/3.jpg)
Meta-Implementation Protocol
Semantics + Reflection = First-Class Implementations
Turn your Lisp into a Meta-Platform
François-René Rideau, TUNES Project
Lightning Talk at the European Lisp Symposium, 2017-04-03
http://fare.tunes.org/files/cs/fci-els2017.pdf
Teaser for my 2017-03-21 presentation at Lisp NYC1
![Page 4: Lightning Talks I - European Lisp SymposiumMeta-Implementation Protocol Semantics + Reflection = First-Class Implementations Turn your Lisp into a Meta-Platform François-René Rideau,](https://reader030.fdocuments.us/reader030/viewer/2022040820/5e695d46283b583d1048a49f/html5/thumbnails/4.jpg)
Basic Intuitions
Good programmers can mentally zoom in and out
of levels of abstraction
Interesting theorems allow you to change
your perspective on existing objects
2
![Page 5: Lightning Talks I - European Lisp SymposiumMeta-Implementation Protocol Semantics + Reflection = First-Class Implementations Turn your Lisp into a Meta-Platform François-René Rideau,](https://reader030.fdocuments.us/reader030/viewer/2022040820/5e695d46283b583d1048a49f/html5/thumbnails/5.jpg)
Semantic Tower
3
![Page 6: Lightning Talks I - European Lisp SymposiumMeta-Implementation Protocol Semantics + Reflection = First-Class Implementations Turn your Lisp into a Meta-Platform François-René Rideau,](https://reader030.fdocuments.us/reader030/viewer/2022040820/5e695d46283b583d1048a49f/html5/thumbnails/6.jpg)
Navigating, not mere debugging
Debugging
Local program state only
Only recover one level of abstraction
One way fixed magic operation
Navigating
Recurse to complete program state
Compose to recover any level you like
First-class operation both ways
4
![Page 7: Lightning Talks I - European Lisp SymposiumMeta-Implementation Protocol Semantics + Reflection = First-Class Implementations Turn your Lisp into a Meta-Platform François-René Rideau,](https://reader030.fdocuments.us/reader030/viewer/2022040820/5e695d46283b583d1048a49f/html5/thumbnails/7.jpg)
Migration
5
![Page 8: Lightning Talks I - European Lisp SymposiumMeta-Implementation Protocol Semantics + Reflection = First-Class Implementations Turn your Lisp into a Meta-Platform François-René Rideau,](https://reader030.fdocuments.us/reader030/viewer/2022040820/5e695d46283b583d1048a49f/html5/thumbnails/8.jpg)
When your hammer is Migration...
Process Migration
Garbage Collection
Zero Copy Routing
Dynamic Configuration
JIT Compilation
etc.
6
![Page 9: Lightning Talks I - European Lisp SymposiumMeta-Implementation Protocol Semantics + Reflection = First-Class Implementations Turn your Lisp into a Meta-Platform François-René Rideau,](https://reader030.fdocuments.us/reader030/viewer/2022040820/5e695d46283b583d1048a49f/html5/thumbnails/9.jpg)
Semantic Towers need not be linear!
7
![Page 10: Lightning Talks I - European Lisp SymposiumMeta-Implementation Protocol Semantics + Reflection = First-Class Implementations Turn your Lisp into a Meta-Platform François-René Rideau,](https://reader030.fdocuments.us/reader030/viewer/2022040820/5e695d46283b583d1048a49f/html5/thumbnails/10.jpg)
New Insights on...
Computation Semantics
Compilation
Semantics-preserving transformations
Aspect-Oriented Programming
Code Instrumentation
Virtualization
Computational Reflection
Software Architecture
Security
8
![Page 11: Lightning Talks I - European Lisp SymposiumMeta-Implementation Protocol Semantics + Reflection = First-Class Implementations Turn your Lisp into a Meta-Platform François-René Rideau,](https://reader030.fdocuments.us/reader030/viewer/2022040820/5e695d46283b583d1048a49f/html5/thumbnails/11.jpg)
First-Class Implementations
Formalizing Implementations: Categories!
Observability: Neglected key concept — safepoints
First-Class Implementations via Protocol Extraction
Explore the Semantic Tower — at runtime!
Principled Reflection: Migration
Natural Transformations generalize Instrumentation
Reflective Architecture: 3D Towers
Social Implications: Platforms, not Applications9
![Page 12: Lightning Talks I - European Lisp SymposiumMeta-Implementation Protocol Semantics + Reflection = First-Class Implementations Turn your Lisp into a Meta-Platform François-René Rideau,](https://reader030.fdocuments.us/reader030/viewer/2022040820/5e695d46283b583d1048a49f/html5/thumbnails/12.jpg)
Challenge
Put the "MIP" in your Lisp
Let’s change software architecture!
Thank you
My blog: Houyhnhnm Computing
http://ngnghm.github.io/
10
![Page 13: Lightning Talks I - European Lisp SymposiumMeta-Implementation Protocol Semantics + Reflection = First-Class Implementations Turn your Lisp into a Meta-Platform François-René Rideau,](https://reader030.fdocuments.us/reader030/viewer/2022040820/5e695d46283b583d1048a49f/html5/thumbnails/13.jpg)
• 01. First-Class Implementations - François-René Rideau
• 02. Reflectable CL Functions Using the MOP - Jim newton
• 03. Erlangen: Async Distributed Msg Passing for CCL - Max Rottenkolber
• 04. A CL Grapher for Implications Between Axioms - Ioanna M. Dimitriou
• 05. cl-jupyter: Lisp-Powered Jupyter Notebooks - Frédéric Peschanski
• 06. Trial, a New CL Game Engine - Nicolas Hafner
![Page 14: Lightning Talks I - European Lisp SymposiumMeta-Implementation Protocol Semantics + Reflection = First-Class Implementations Turn your Lisp into a Meta-Platform François-René Rideau,](https://reader030.fdocuments.us/reader030/viewer/2022040820/5e695d46283b583d1048a49f/html5/thumbnails/14.jpg)
EnlighteninglightningtalkELS2017
UsingtheMOP
ReflectableCLfunc>ons
![Page 15: Lightning Talks I - European Lisp SymposiumMeta-Implementation Protocol Semantics + Reflection = First-Class Implementations Turn your Lisp into a Meta-Platform François-René Rideau,](https://reader030.fdocuments.us/reader030/viewer/2022040820/5e695d46283b583d1048a49f/html5/thumbnails/15.jpg)
Toomanyfunc>ons.Igetconfused,needhelpdebugging.
(defmethodmap-pxls((p-pxl-itersparallel-pxl-iters)
&keyunaryaggregate
(mk-unary(lambda()unary)))
(let((0-ary-functions
(mapcar(lambda(p-pxl-iter
&aux(unary(funcallmk-unary)))
(lambda()
(map-pxlsp-pxl-iter:unaryunary)))
(pxl-itersp-pxl-iters))))
(lparallel:preduce(lambda(vf)
(funcallaggregatev(funcallf)))
0-ary-functions)))
![Page 16: Lightning Talks I - European Lisp SymposiumMeta-Implementation Protocol Semantics + Reflection = First-Class Implementations Turn your Lisp into a Meta-Platform François-René Rideau,](https://reader030.fdocuments.us/reader030/viewer/2022040820/5e695d46283b583d1048a49f/html5/thumbnails/16.jpg)
Declaringfunc>ontypesdoesn'thelp.Compilerignorescontent.
(defmethodmap-pxls((p-pxl-itersparallel-pxl-iters)
&keyunaryaggregate
(mk-unary(lambda()unary)))
(declare(type(function(t)t)unary)
(type(function()(function(t)t))mk-unary)
(type(function(tt)t)aggregate))
(let((0-ary-functions
(mapcar(lambda(p-pxl-iter
&aux(unary(funcallmk-unary)))
(lambda()
(map-pxlsp-pxl-iter:unaryunary)))
(pxl-itersp-pxl-iters))))
...
![Page 17: Lightning Talks I - European Lisp SymposiumMeta-Implementation Protocol Semantics + Reflection = First-Class Implementations Turn your Lisp into a Meta-Platform François-René Rideau,](https://reader030.fdocuments.us/reader030/viewer/2022040820/5e695d46283b583d1048a49f/html5/thumbnails/17.jpg)
Run->mefunc>onasser>onfails.(defmethodmap-pxls((p-pxl-itersparallel-pxl-iters)
&keyunaryaggregate
(mk-unary(lambda()unary)))
(let((0-ary-functions
(mapcar(lambda(p-pxl-iter
&aux(unary(funcallmk-unary)))
(assert(typepmk-unary‘(function()t)))
(assert(typepunary‘(function(t)t)))
(lambda()
(map-pxlsp-pxl-iter:unaryunary)))
(pxl-itersp-pxl-iters))))
(lparallel:preduce(lambda(vf)
(funcallaggregatev(funcallf)))
0-ary-functions)))
![Page 18: Lightning Talks I - European Lisp SymposiumMeta-Implementation Protocol Semantics + Reflection = First-Class Implementations Turn your Lisp into a Meta-Platform François-René Rideau,](https://reader030.fdocuments.us/reader030/viewer/2022040820/5e695d46283b583d1048a49f/html5/thumbnails/18.jpg)
CLspecifica>onofFunc%onTYPEP
• Anerroroftypeerrorissignalediftype-specifierisvalues,oratypespecifierlistwhosefirstelementiseitherfunc>onorvalues.
• (assert(typepunary‘(function(t)t)))
![Page 19: Lightning Talks I - European Lisp SymposiumMeta-Implementation Protocol Semantics + Reflection = First-Class Implementations Turn your Lisp into a Meta-Platform François-René Rideau,](https://reader030.fdocuments.us/reader030/viewer/2022040820/5e695d46283b583d1048a49f/html5/thumbnails/19.jpg)
Defineclasswith:metaclasscloser-mop::funcallable-standard-class
(defclassreflectable-function()((function:initarg:function:typefunction)(body:initarg:body)(lambda-list:initarg:lambda-list))(:metaclasscloser-mop:funcallable-standard-class))(defmethodinitialize-instance:after((selfreflectable-function)&key)(closer-mop:set-funcallable-instance-functionself(slot-valueself'function)))(defmacrorefl-lambda(lambda-list&restbody)`(make-instance'reflectable-function:function(lambda,lambda-list,@body):body',body:lambda-list',lambda-list))
![Page 20: Lightning Talks I - European Lisp SymposiumMeta-Implementation Protocol Semantics + Reflection = First-Class Implementations Turn your Lisp into a Meta-Platform François-René Rideau,](https://reader030.fdocuments.us/reader030/viewer/2022040820/5e695d46283b583d1048a49f/html5/thumbnails/20.jpg)
Defineatypeintersec>ngtheclass(defunrefl-2-ary(obj)
(and(typepobj'reflectable-function)
(=2(length(slot-valueobj'lambda-list)))))
(deftyperefl-2-ary()
`(andreflectable-function
(satisfiesrefl-2-ary)))
(map-pxlsp-iters
:unary(refl-lambda(pxl)
(redpxl))
:aggregate(refl-lambda(v2v2)
(maxv1v2)))
![Page 21: Lightning Talks I - European Lisp SymposiumMeta-Implementation Protocol Semantics + Reflection = First-Class Implementations Turn your Lisp into a Meta-Platform François-René Rideau,](https://reader030.fdocuments.us/reader030/viewer/2022040820/5e695d46283b583d1048a49f/html5/thumbnails/21.jpg)
Declareaway!Assertaway!(defmethodmap-pxls((p-pxl-itersparallel-pxl-iters)&keyunaryaggregate(mk-unary(refl-lambda()unary)))(declare(typerefl-1-aryunary)(typerefl-0-arymk-unary)(typerefl-2-aryaggregate))(let((0-ary-functions(mapcar(lambda(p-pxl-iter&aux(unary(funcallmk-unary)))(assert(typepunary‘refl-1-ary))(refl-lambda()(map-pxlsp-pxl-iter:unaryunary)))(pxl-itersp-pxl-iters))))(lparallel:preduce(lambda(vf)(declare(typerefl-0-aryf))(funcallaggregatev(funcallf)))0-ary-functions)))
![Page 22: Lightning Talks I - European Lisp SymposiumMeta-Implementation Protocol Semantics + Reflection = First-Class Implementations Turn your Lisp into a Meta-Platform François-René Rideau,](https://reader030.fdocuments.us/reader030/viewer/2022040820/5e695d46283b583d1048a49f/html5/thumbnails/22.jpg)
Ques>ons?
i
Acknowledgement:ThankstoPascalCostanzaforCLOSER-TO-MOP
![Page 23: Lightning Talks I - European Lisp SymposiumMeta-Implementation Protocol Semantics + Reflection = First-Class Implementations Turn your Lisp into a Meta-Platform François-René Rideau,](https://reader030.fdocuments.us/reader030/viewer/2022040820/5e695d46283b583d1048a49f/html5/thumbnails/23.jpg)
• 01. First-Class Implementations - François-René Rideau
• 02. Reflectable CL Functions Using the MOP - Jim newton
• 03. Erlangen: Async Distributed Msg Passing for CCL - Max Rottenkolber
• 04. A CL Grapher for Implications Between Axioms - Ioanna M. Dimitriou
• 05. cl-jupyter: Lisp-Powered Jupyter Notebooks - Frédéric Peschanski
• 06. Trial, a New CL Game Engine - Nicolas Hafner
![Page 24: Lightning Talks I - European Lisp SymposiumMeta-Implementation Protocol Semantics + Reflection = First-Class Implementations Turn your Lisp into a Meta-Platform François-René Rideau,](https://reader030.fdocuments.us/reader030/viewer/2022040820/5e695d46283b583d1048a49f/html5/thumbnails/24.jpg)
![Page 25: Lightning Talks I - European Lisp SymposiumMeta-Implementation Protocol Semantics + Reflection = First-Class Implementations Turn your Lisp into a Meta-Platform François-René Rideau,](https://reader030.fdocuments.us/reader030/viewer/2022040820/5e695d46283b583d1048a49f/html5/thumbnails/25.jpg)
•
•
•
•
![Page 26: Lightning Talks I - European Lisp SymposiumMeta-Implementation Protocol Semantics + Reflection = First-Class Implementations Turn your Lisp into a Meta-Platform François-René Rideau,](https://reader030.fdocuments.us/reader030/viewer/2022040820/5e695d46283b583d1048a49f/html5/thumbnails/26.jpg)
•
•
•
•
![Page 27: Lightning Talks I - European Lisp SymposiumMeta-Implementation Protocol Semantics + Reflection = First-Class Implementations Turn your Lisp into a Meta-Platform François-René Rideau,](https://reader030.fdocuments.us/reader030/viewer/2022040820/5e695d46283b583d1048a49f/html5/thumbnails/27.jpg)
•
•
•
![Page 28: Lightning Talks I - European Lisp SymposiumMeta-Implementation Protocol Semantics + Reflection = First-Class Implementations Turn your Lisp into a Meta-Platform François-René Rideau,](https://reader030.fdocuments.us/reader030/viewer/2022040820/5e695d46283b583d1048a49f/html5/thumbnails/28.jpg)
root-supervisor (one-for-one)
service-supervisor (one-for-one) logger
feed-importer scanner-supervisor (one-for-all) socket-supervisor (one-for-one)
scan-timer scanner http-1 http-2 http-3 http-…
![Page 29: Lightning Talks I - European Lisp SymposiumMeta-Implementation Protocol Semantics + Reflection = First-Class Implementations Turn your Lisp into a Meta-Platform François-René Rideau,](https://reader030.fdocuments.us/reader030/viewer/2022040820/5e695d46283b583d1048a49f/html5/thumbnails/29.jpg)
![Page 30: Lightning Talks I - European Lisp SymposiumMeta-Implementation Protocol Semantics + Reflection = First-Class Implementations Turn your Lisp into a Meta-Platform François-René Rideau,](https://reader030.fdocuments.us/reader030/viewer/2022040820/5e695d46283b583d1048a49f/html5/thumbnails/30.jpg)
•
•
•
![Page 31: Lightning Talks I - European Lisp SymposiumMeta-Implementation Protocol Semantics + Reflection = First-Class Implementations Turn your Lisp into a Meta-Platform François-René Rideau,](https://reader030.fdocuments.us/reader030/viewer/2022040820/5e695d46283b583d1048a49f/html5/thumbnails/31.jpg)
•
•
•
•
•
•
•
![Page 32: Lightning Talks I - European Lisp SymposiumMeta-Implementation Protocol Semantics + Reflection = First-Class Implementations Turn your Lisp into a Meta-Platform François-René Rideau,](https://reader030.fdocuments.us/reader030/viewer/2022040820/5e695d46283b583d1048a49f/html5/thumbnails/32.jpg)
•
•
•
•
![Page 33: Lightning Talks I - European Lisp SymposiumMeta-Implementation Protocol Semantics + Reflection = First-Class Implementations Turn your Lisp into a Meta-Platform François-René Rideau,](https://reader030.fdocuments.us/reader030/viewer/2022040820/5e695d46283b583d1048a49f/html5/thumbnails/33.jpg)
• 01. First-Class Implementations - François-René Rideau
• 02. Reflectable CL Functions Using the MOP - Jim newton
• 03. Erlangen: Async Distributed Msg Passing for CCL - Max Rottenkolber
• 04. A CL Grapher for Implications Between Axioms - Ioanna M. Dimitriou
• 05. cl-jupyter: Lisp-Powered Jupyter Notebooks - Frédéric Peschanski
• 06. Trial, a New CL Game Engine - Nicolas Hafner
![Page 34: Lightning Talks I - European Lisp SymposiumMeta-Implementation Protocol Semantics + Reflection = First-Class Implementations Turn your Lisp into a Meta-Platform François-René Rideau,](https://reader030.fdocuments.us/reader030/viewer/2022040820/5e695d46283b583d1048a49f/html5/thumbnails/34.jpg)
cgraph.inters.co
graphing implications of classical logic
Ioanna M. Dimitriou
European Lisp Symposium 2017 - lightning session
![Page 35: Lightning Talks I - European Lisp SymposiumMeta-Implementation Protocol Semantics + Reflection = First-Class Implementations Turn your Lisp into a Meta-Platform François-René Rideau,](https://reader030.fdocuments.us/reader030/viewer/2022040820/5e695d46283b583d1048a49f/html5/thumbnails/35.jpg)
![Page 36: Lightning Talks I - European Lisp SymposiumMeta-Implementation Protocol Semantics + Reflection = First-Class Implementations Turn your Lisp into a Meta-Platform François-René Rideau,](https://reader030.fdocuments.us/reader030/viewer/2022040820/5e695d46283b583d1048a49f/html5/thumbnails/36.jpg)
![Page 37: Lightning Talks I - European Lisp SymposiumMeta-Implementation Protocol Semantics + Reflection = First-Class Implementations Turn your Lisp into a Meta-Platform François-René Rideau,](https://reader030.fdocuments.us/reader030/viewer/2022040820/5e695d46283b583d1048a49f/html5/thumbnails/37.jpg)
![Page 38: Lightning Talks I - European Lisp SymposiumMeta-Implementation Protocol Semantics + Reflection = First-Class Implementations Turn your Lisp into a Meta-Platform François-René Rideau,](https://reader030.fdocuments.us/reader030/viewer/2022040820/5e695d46283b583d1048a49f/html5/thumbnails/38.jpg)
![Page 39: Lightning Talks I - European Lisp SymposiumMeta-Implementation Protocol Semantics + Reflection = First-Class Implementations Turn your Lisp into a Meta-Platform François-René Rideau,](https://reader030.fdocuments.us/reader030/viewer/2022040820/5e695d46283b583d1048a49f/html5/thumbnails/39.jpg)
A
D C
B
T
T
NIL
(
g
r
a
p
h
-
i
m
p
l
i
e
s
-
n
ot
-
p
B
A
)
?
T
![Page 40: Lightning Talks I - European Lisp SymposiumMeta-Implementation Protocol Semantics + Reflection = First-Class Implementations Turn your Lisp into a Meta-Platform François-René Rideau,](https://reader030.fdocuments.us/reader030/viewer/2022040820/5e695d46283b583d1048a49f/html5/thumbnails/40.jpg)
A
. ..
A-desc. B-anc.
. ..
B
T
T
T
T
NIL
(
g
r
a
p
h
-
i
m
p
l
i
e
s
-
n
ot
-
p
B
A
)
?
![Page 41: Lightning Talks I - European Lisp SymposiumMeta-Implementation Protocol Semantics + Reflection = First-Class Implementations Turn your Lisp into a Meta-Platform François-René Rideau,](https://reader030.fdocuments.us/reader030/viewer/2022040820/5e695d46283b583d1048a49f/html5/thumbnails/41.jpg)
cgraph.inters.co
Stack
Common Lisp
Quicklisp
backend:
maxpc
split-sequence
bash scripts
graphviz dot + tred
external-program
frontend:
hunchentoot
html-template
a tiny JavaScript file
![Page 42: Lightning Talks I - European Lisp SymposiumMeta-Implementation Protocol Semantics + Reflection = First-Class Implementations Turn your Lisp into a Meta-Platform François-René Rideau,](https://reader030.fdocuments.us/reader030/viewer/2022040820/5e695d46283b583d1048a49f/html5/thumbnails/42.jpg)
for more details: cgraph.inters.co
github.com/ioannad/jeffrey
posts on boolesrings.org/ioanna
the full graph
![Page 43: Lightning Talks I - European Lisp SymposiumMeta-Implementation Protocol Semantics + Reflection = First-Class Implementations Turn your Lisp into a Meta-Platform François-René Rideau,](https://reader030.fdocuments.us/reader030/viewer/2022040820/5e695d46283b583d1048a49f/html5/thumbnails/43.jpg)
• 01. First-Class Implementations - François-René Rideau
• 02. Reflectable CL Functions Using the MOP - Jim newton
• 03. Erlangen: Async Distributed Msg Passing for CCL - Max Rottenkolber
• 04. A CL Grapher for Implications Between Axioms - Ioanna M. Dimitriou
• 05. cl-jupyter: Lisp-Powered Jupyter Notebooks - Frédéric Peschanski
• 06. Trial, a New CL Game Engine - Nicolas Hafner
![Page 44: Lightning Talks I - European Lisp SymposiumMeta-Implementation Protocol Semantics + Reflection = First-Class Implementations Turn your Lisp into a Meta-Platform François-René Rideau,](https://reader030.fdocuments.us/reader030/viewer/2022040820/5e695d46283b583d1048a49f/html5/thumbnails/44.jpg)
• 01. First-Class Implementations - François-René Rideau
• 02. Reflectable CL Functions Using the MOP - Jim newton
• 03. Erlangen: Async Distributed Msg Passing for CCL - Max Rottenkolber
• 04. A CL Grapher for Implications Between Axioms - Ioanna M. Dimitriou
• 05. cl-jupyter: Lisp-Powered Jupyter Notebooks - Frédéric Peschanski
• 06. Trial, a New CL Game Engine - Nicolas Hafner