Lightning Talks I - European Lisp SymposiumMeta-Implementation Protocol Semantics + Reflection =...

Post on 11-Mar-2020

1 views 0 download

Transcript of Lightning Talks I - European Lisp SymposiumMeta-Implementation Protocol Semantics + Reflection =...

Lightning Talks IELS 2017

• 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

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

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

Semantic Tower

3

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

Migration

5

When your hammer is Migration...

Process Migration

Garbage Collection

Zero Copy Routing

Dynamic Configuration

JIT Compilation

etc.

6

Semantic Towers need not be linear!

7

New Insights on...

Computation Semantics

Compilation

Semantics-preserving transformations

Aspect-Oriented Programming

Code Instrumentation

Virtualization

Computational Reflection

Software Architecture

Security

8

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

Challenge

Put the "MIP" in your Lisp

Let’s change software architecture!

Thank you

My blog: Houyhnhnm Computing

http://ngnghm.github.io/

10

• 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

EnlighteninglightningtalkELS2017

UsingtheMOP

ReflectableCLfunc>ons

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

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

...

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

CLspecifica>onofFunc%onTYPEP

•  Anerroroftypeerrorissignalediftype-specifierisvalues,oratypespecifierlistwhosefirstelementiseitherfunc>onorvalues.

•  (assert(typepunary‘(function(t)t)))

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

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

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

Ques>ons?

i

Acknowledgement:ThankstoPascalCostanzaforCLOSER-TO-MOP

• 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

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

• 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

cgraph.inters.co

graphing implications of classical logic

Ioanna M. Dimitriou

European Lisp Symposium 2017 - lightning session

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

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

)

?

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

for more details: cgraph.inters.co

github.com/ioannad/jeffrey

posts on boolesrings.org/ioanna

ioanna.m.dimitriou@gmail.com

the full graph

• 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

• 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