lightning talks i - european lisp symposiummeta-implementation protocol semantics + reflection =...

44
Lightning Talks I ELS 2017

Upload: others

Post on 11-Mar-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

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,

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,

• 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,

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,

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,

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,

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,

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,

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,

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,

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,

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,

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,

• 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,

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,

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,

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,

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,

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,

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,

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,

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,

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,

• 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,
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,

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,

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,

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,

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,
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,

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,

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,

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,

• 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,

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,
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,
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,
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,
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,

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,

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,

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,

for more details: cgraph.inters.co

github.com/ioannad/jeffrey

posts on boolesrings.org/ioanna

[email protected]

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,

• 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,

• 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