SlideShare a Scribd company logo
(Taming the Meta-Language, Part 2)
First-Class File
A long long time ago...
A long long time ago...
// this prints 5 times
print(1)
print(2)
print(3)
print(4)
print(5)
A long long time ago...
// this prints 11 times
print(1)
print(2)
print(3)
print(4)
print(5)
print(6)
print(7)
print(8)
print(9)
print(10)
print(11)
A long long time ago...
// @pragma 2-10
print(2)
print(3)
print(4)
print(5)
print(6)
print(7)
print(8)
print(9)
print(10)
// @end pragma 2-10
A long long time ago...
print(1)
A long long time ago...
for (i from 2 to 20) {
print(i)
}
Motivation
• Meta language, part 2 (concrete)
• Single Reason/OCaml feature
github.com/facebook/reason
github.com/reasonml/reason-react
discord.gg/reasonml
Ladder
• data
• function
• ...? React Component?
• ...??
require('myLibrary/myFile')
Ladder
• data
• function
• ...? React Component?
• ...??
• ...???
Module
Module
Module
• Module
• Module type
• Module function
type profession = ... /* type */
let person1 = ... /* binding */
let getProfession person => ... /* function */
type profession = ...
let person1 = ...
let getProfession person => ...
module School = { /* <-- module */
type profession = ...
let person1 = ...
let getProfession person => ...
};
module School = { /* <-- module */
type profession = ...
let person1 = ...
let getProfession person => ...
module GPA = {...} /* <-- nested module */
};
module School = { /* <-- module */
type profession = ...
let person1 = ...
let getProfession person => ...
module GPA = {...} /* <-- nested module */
};
let anotherPerson: School.profession = ...
module BaseComponent = {
let greeting = "Hello from base component";
let count = 10;
};
module ActualComponent = {
include BaseComponent; /* <-- JS object spread! */
let greeting = "Hello from actual component";
};
// Generated by BUCKLESCRIPT VERSION 1.2.1,
// PLEASE EDIT WITH CARE
var BaseComponent = /* module */[
/* greeting */"Hello from base component",
/* count */10
];
var ActualComponent = /* module */[
/* count */10,
/* greeting */"Hello from actual component"
];
module BaseComponent = {
let greeting = "Hello from base component";
let count = 10;
};
module ActualComponent = {
include BaseComponent; /* <-- JS object spread! */
let greeting = "Hello from actual component";
};
What Did We Push Down?
• Disciplined "mixins"
What Did We Push Down?
• Disciplined "mixins"
module BaseComponent = {
let greeting = "Hello from base component";
let count = 10;
};
module ActualComponent = {
include BaseComponent; /* <-- JS object spread! */
let greeting = "Hello from actual component";
};
What Did We Push Down?
• Disciplined "mixins"
module BaseComponent = {
let greeting = "Hello from base component";
let count = 10;
};
module ActualComponent = {
include BaseComponent; /* <-- JS object spread! */
let greeting = "Hello from actual component";
};
Surprise!
Every File Is a Module
Every File Is a Module
type profession = ... /* type */
let person1 = ... /* binding */
let getProfession person => ... /* function */
Every File Is a Module
module School = {
type profession = ...
let person1 = ...
let getProfession person => ...
};
Every File Is a Module
/* school.re */
module School = {
type profession = ...
let person1 = ...
let getProfession person => ...
};
Every File Is a Module
/* school.re */
type profession = ...
let person1 = ...
let getProfession person => ...
Every File Is a Module
/* school.re */
type profession = ...
let person1 = ...
let getProfession person => ...
/* agenda.re */
let p = School.person 1;
Every File Is a Module
/* school.re */
type profession = ...
let person1 = ...
let getProfession person => ...
module GPA = {...} /* <-- nested module */
/* agenda.re */
let p = School.person 1;
Every File Is a Module
/* school.re */
module GPA = {...};
module Records = {...};
module Rooms = {...};
Every File Is a Module
/* a.re */
let a = 1;
let b = 2;
let c = 3;
/* b.re */
include A;
What Did We Push Down?
• Code generation
Module Type (Signature)
Module Type (Signature)
module School = {
type person = string;
type people = list person;
let peopleDatabase: people = ["Mary", "John", "joe"];
let addPerson (p: person) (database: people) => [p, ...database];
let sortPeopleAlphabetically (database: people) => ...
};
Module Type (Signature)
module School = {
type person = string;
type people = list person;
let peopleDatabase: people = ["Mary", "John", "joe"];
let addPerson (p: person) (database: people) => [p, ...database];
let sortPeopleAlphabetically (database: people) => ...
};
Module Type (Signature)
module School = {
type person = string;
type people = list person;
let peopleDatabase: people = ["Mary", "John", "joe"];
let addPerson (p: person) (database: people) => [p, ...database];
let sortPeopleAlphabetically (database: people) => ...
};
Module Type (Signature)
module School = {
type person = string;
type people = list person;
let peopleDatabase: people = ["Mary", "John", "joe"];
let addPerson (p: person) (database: people) => [p, ...database];
let sortPeopleAlphabetically (database: people) => ...
};
Module Type (Signature)
module School = {
type person = string;
type people = list person;
let peopleDatabase: people = ["Mary", "John", "joe"];
let addPerson (p: person) (database: people) => [p, ...database];
let sortPeopleAlphabetically (database: people) => ...
};
module School = {
type person = string;
type people = list person;
let peopleDatabase: people = ["Mary", "John", "joe"];
let addPerson (p: person) (database: people) => [p, ...database];
let sortPeopleAlphabetically (database: people) => ...
};
module School = {
type person = string;
type people = list person;
let peopleDatabase: people = ["Mary", "John", "joe"];
let addPerson (p: person) (database: people) => [p, ...database];
let sortPeopleAlphabetically (database: people) => ...
};
{
type person = string;
type people = list person;
let peopleDatabase: people;
let addPerson: person => people => people;
let sortPeopleAlphabetically: people => people;
};
module School: SchoolType = {
type person = string;
type people = list person;
let peopleDatabase: people = ["Mary", "John", "joe"];
let addPerson (p: person) (database: people) => [p, ...database];
let sortPeopleAlphabetically (database: people) => ...
};
module type SchoolType = {
type person = string;
type people = list person;
let peopleDatabase: people;
let addPerson: person => people => people;
let sortPeopleAlphabetically: people => people;
};
• Module (Foo) -> normal file (foo.re)
• Module type (Foo) -> ???
• Module (Foo) -> normal file (foo.re)
• Module type (Foo) -> interface file (foo.rei)
What Did We Push Down?
• formalized documentation
module School: SchoolType = {
type person = string;
type people = list person;
let peopleDatabase: people = ["Mary", "John", "joe"];
let addPerson (p: person) (database: people) => [p, ...database];
let sortPeopleAlphabetically (database: people) => ...
};
module type SchoolType = {
type person = string;
type people = list person;
let peopleDatabase: people;
let addPerson: person => people => people;
let sortPeopleAlphabetically: people => people;
};
module School: SchoolType = {
type person = string;
type people = list person;
let peopleDatabase: people = ["Mary", "John", "joe"];
let addPerson (p: person) (database: people) => [p, ...database];
let sortPeopleAlphabetically (database: people) => ...
};
module type SchoolType = {
type person = string;
type people = list person;
let peopleDatabase: people;
let addPerson: person => people => people;
/* let sortPeopleAlphabetically: people => people; */
};
module School: SchoolType = {
type person = string;
type people = list person;
let peopleDatabase: people = ["Mary", "John", "joe"];
let addPerson (p: person) (database: people) => [p, ...database];
let sortPeopleAlphabetically (database: people) => ...
};
module type SchoolType = {
type person = string;
type people = list person;
let peopleDatabase: people;
let addPerson: person => people => people;
/* let sortPeopleAlphabetically: people => people; */
};
Last Trick: abstract type
Last Trick: abstract type
• "Lots of languages have facilities for encapsulation, but not
abstraction"
Last Trick: abstract type
module type SchoolType = {
type person = string;
type people = list person;
let peopleDatabase: people;
let addPerson: person => people => people;
let sortPeopleAlphabetically: people => people;
};
Last Trick: abstract type
module type SchoolType = {
type person = string;
type people = list person;
let peopleDatabase: people;
let addPerson: person => people => people;
/* let sortPeopleAlphabetically: people => people; */
};
Last Trick: abstract type
module type SchoolType = {
type person = string;
type people = list person;
let peopleDatabase: people;
let addPerson: person => people => people;
let sortPeopleAlphabetically: people => people;
};
Last Trick: abstract type
module type SchoolType = {
type person /* = string */;
type people /* = list person */;
let peopleDatabase: people;
let addPerson: person => people => people;
let sortPeopleAlphabetically: people => people;
};
Last Trick: abstract type
module type SchoolType = {
type person;
type people;
let peopleDatabase: people;
let addPerson: person => people => people;
let sortPeopleAlphabetically: people => people;
};
Last Trick: abstract type
module type SchoolType = {
type person;
type people;
let peopleDatabase: people;
let addPerson: person => people => people;
let sortPeopleAlphabetically: people => people;
};
What Did We Push Down?
• Encapsulation: The implementation details stay implementation
details
React.__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED
• Abstraction: nuance of breaking change migration paths
What Did We Push Down?
• Encapsulation: The implementation details stay implementation
details
React.__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED
• Abstraction: nuance of breaking change migration paths
Module Function (Functor)
Where Are We Going?
github.com/facebook/reason
github.com/reasonml/reason-react
discord.gg/reasonml

More Related Content

What's hot

Hibernate Inheritenc Mapping
Hibernate Inheritenc MappingHibernate Inheritenc Mapping
Hibernate Inheritenc Mapping
javafasttrack
 
Introduction To Moose
Introduction To MooseIntroduction To Moose
Introduction To Moose
Mike Whitaker
 
Random And Dynamic Images Using Python Cgi
Random And Dynamic Images Using Python CgiRandom And Dynamic Images Using Python Cgi
Random And Dynamic Images Using Python Cgi
AkramWaseem
 
Java 8 Examples
Java 8 ExamplesJava 8 Examples
Java 8 Examples
Scott Taylor
 
Python Tricks That You Can't Live Without
Python Tricks That You Can't Live WithoutPython Tricks That You Can't Live Without
Python Tricks That You Can't Live Without
Audrey Roy
 
Go for Object Oriented Programmers or Object Oriented Programming without Obj...
Go for Object Oriented Programmers or Object Oriented Programming without Obj...Go for Object Oriented Programmers or Object Oriented Programming without Obj...
Go for Object Oriented Programmers or Object Oriented Programming without Obj...
Steven Francia
 
Nothing Hard Baked: Designing the Inclusive Web
Nothing Hard Baked: Designing the Inclusive WebNothing Hard Baked: Designing the Inclusive Web
Nothing Hard Baked: Designing the Inclusive Web
colinbdclark
 
User Interface Development with jQuery
User Interface Development with jQueryUser Interface Development with jQuery
User Interface Development with jQuery
colinbdclark
 
Hacking the WebPAC
Hacking the WebPACHacking the WebPAC
Hacking the WebPAC
jcjones6
 
Yahoo is open to developers
Yahoo is open to developersYahoo is open to developers
Yahoo is open to developers
Christian Heilmann
 
Building Non-shit APIs with JavaScript
Building Non-shit APIs with JavaScriptBuilding Non-shit APIs with JavaScript
Building Non-shit APIs with JavaScript
danwrong
 
[E-Dev-Day 2014][4/16] Review of Eolian, Eo, Bindings, Interfaces and What's ...
[E-Dev-Day 2014][4/16] Review of Eolian, Eo, Bindings, Interfaces and What's ...[E-Dev-Day 2014][4/16] Review of Eolian, Eo, Bindings, Interfaces and What's ...
[E-Dev-Day 2014][4/16] Review of Eolian, Eo, Bindings, Interfaces and What's ...
EnlightenmentProject
 
7 Common mistakes in Go and when to avoid them
7 Common mistakes in Go and when to avoid them7 Common mistakes in Go and when to avoid them
7 Common mistakes in Go and when to avoid them
Steven Francia
 
Freebase Schema
Freebase SchemaFreebase Schema
Freebase Schema
Jamie Taylor
 
Introduction to the Ruby Object Model
Introduction to the Ruby Object ModelIntroduction to the Ruby Object Model
Introduction to the Ruby Object Model
Miki Shiran
 
Conf orm - explain
Conf orm - explainConf orm - explain
Conf orm - explain
Louise Grandjonc
 
jQuery Features to Avoid
jQuery Features to AvoidjQuery Features to Avoid
jQuery Features to Avoid
dmethvin
 
Grails - The search is over
Grails - The search is overGrails - The search is over
Grails - The search is over
Felipe Coutinho
 
Anonymous Classes: Behind the Mask
Anonymous Classes: Behind the MaskAnonymous Classes: Behind the Mask
Anonymous Classes: Behind the Mask
Mark Baker
 
7 Common Mistakes in Go (2015)
7 Common Mistakes in Go (2015)7 Common Mistakes in Go (2015)
7 Common Mistakes in Go (2015)
Steven Francia
 

What's hot (20)

Hibernate Inheritenc Mapping
Hibernate Inheritenc MappingHibernate Inheritenc Mapping
Hibernate Inheritenc Mapping
 
Introduction To Moose
Introduction To MooseIntroduction To Moose
Introduction To Moose
 
Random And Dynamic Images Using Python Cgi
Random And Dynamic Images Using Python CgiRandom And Dynamic Images Using Python Cgi
Random And Dynamic Images Using Python Cgi
 
Java 8 Examples
Java 8 ExamplesJava 8 Examples
Java 8 Examples
 
Python Tricks That You Can't Live Without
Python Tricks That You Can't Live WithoutPython Tricks That You Can't Live Without
Python Tricks That You Can't Live Without
 
Go for Object Oriented Programmers or Object Oriented Programming without Obj...
Go for Object Oriented Programmers or Object Oriented Programming without Obj...Go for Object Oriented Programmers or Object Oriented Programming without Obj...
Go for Object Oriented Programmers or Object Oriented Programming without Obj...
 
Nothing Hard Baked: Designing the Inclusive Web
Nothing Hard Baked: Designing the Inclusive WebNothing Hard Baked: Designing the Inclusive Web
Nothing Hard Baked: Designing the Inclusive Web
 
User Interface Development with jQuery
User Interface Development with jQueryUser Interface Development with jQuery
User Interface Development with jQuery
 
Hacking the WebPAC
Hacking the WebPACHacking the WebPAC
Hacking the WebPAC
 
Yahoo is open to developers
Yahoo is open to developersYahoo is open to developers
Yahoo is open to developers
 
Building Non-shit APIs with JavaScript
Building Non-shit APIs with JavaScriptBuilding Non-shit APIs with JavaScript
Building Non-shit APIs with JavaScript
 
[E-Dev-Day 2014][4/16] Review of Eolian, Eo, Bindings, Interfaces and What's ...
[E-Dev-Day 2014][4/16] Review of Eolian, Eo, Bindings, Interfaces and What's ...[E-Dev-Day 2014][4/16] Review of Eolian, Eo, Bindings, Interfaces and What's ...
[E-Dev-Day 2014][4/16] Review of Eolian, Eo, Bindings, Interfaces and What's ...
 
7 Common mistakes in Go and when to avoid them
7 Common mistakes in Go and when to avoid them7 Common mistakes in Go and when to avoid them
7 Common mistakes in Go and when to avoid them
 
Freebase Schema
Freebase SchemaFreebase Schema
Freebase Schema
 
Introduction to the Ruby Object Model
Introduction to the Ruby Object ModelIntroduction to the Ruby Object Model
Introduction to the Ruby Object Model
 
Conf orm - explain
Conf orm - explainConf orm - explain
Conf orm - explain
 
jQuery Features to Avoid
jQuery Features to AvoidjQuery Features to Avoid
jQuery Features to Avoid
 
Grails - The search is over
Grails - The search is overGrails - The search is over
Grails - The search is over
 
Anonymous Classes: Behind the Mask
Anonymous Classes: Behind the MaskAnonymous Classes: Behind the Mask
Anonymous Classes: Behind the Mask
 
7 Common Mistakes in Go (2015)
7 Common Mistakes in Go (2015)7 Common Mistakes in Go (2015)
7 Common Mistakes in Go (2015)
 

Similar to What's in a language? By Cheng Lou

F# for C# Programmers
F# for C# ProgrammersF# for C# Programmers
F# for C# Programmers
Scott Wlaschin
 
Declarative Development Using Annotations In PHP
Declarative Development Using Annotations In PHPDeclarative Development Using Annotations In PHP
Declarative Development Using Annotations In PHP
Stephan Schmidt
 
Declarative Development Using Annotations In PHP
Declarative Development Using Annotations In PHPDeclarative Development Using Annotations In PHP
Declarative Development Using Annotations In PHP
stubbles
 
Student DATABASE MANAGeMEnT SysTEm
Student DATABASE MANAGeMEnT SysTEmStudent DATABASE MANAGeMEnT SysTEm
Student DATABASE MANAGeMEnT SysTEm
home
 
Desarrollando aplicaciones web en minutos
Desarrollando aplicaciones web en minutosDesarrollando aplicaciones web en minutos
Desarrollando aplicaciones web en minutos
Edgar Suarez
 
AST Transformations at JFokus
AST Transformations at JFokusAST Transformations at JFokus
AST Transformations at JFokus
HamletDRC
 
Python slide
Python slidePython slide
Swift - Modern & Expressive, or Magical Unicorn?
Swift  - Modern & Expressive, or Magical Unicorn?Swift  - Modern & Expressive, or Magical Unicorn?
Swift - Modern & Expressive, or Magical Unicorn?
Mike Jones
 
Demystifying Object-Oriented Programming - Midwest PHP
Demystifying Object-Oriented Programming - Midwest PHPDemystifying Object-Oriented Programming - Midwest PHP
Demystifying Object-Oriented Programming - Midwest PHP
Alena Holligan
 
Fantom and Tales
Fantom and TalesFantom and Tales
Fantom and Tales
kaushik_sathupadi
 
Programming Under Linux In Python
Programming Under Linux In PythonProgramming Under Linux In Python
Programming Under Linux In Python
Marwan Osman
 
Kotlin intro
Kotlin introKotlin intro
Kotlin intro
Elifarley Cruz
 
Postobjektové programovanie v Ruby
Postobjektové programovanie v RubyPostobjektové programovanie v Ruby
Postobjektové programovanie v Ruby
Jano Suchal
 
Java for beginners
Java for beginnersJava for beginners
Java for beginners
Saeid Zebardast
 
Object-oriented Programming-with C#
Object-oriented Programming-with C#Object-oriented Programming-with C#
Object-oriented Programming-with C#
Doncho Minkov
 
Bioinformatics p5-bioperl v2013-wim_vancriekinge
Bioinformatics p5-bioperl v2013-wim_vancriekingeBioinformatics p5-bioperl v2013-wim_vancriekinge
Bioinformatics p5-bioperl v2013-wim_vancriekinge
Prof. Wim Van Criekinge
 
Meetup di GDG Italia - Leonardo Pirro - Codemotion Rome 2018
Meetup di GDG Italia - Leonardo Pirro -  Codemotion Rome 2018 Meetup di GDG Italia - Leonardo Pirro -  Codemotion Rome 2018
Meetup di GDG Italia - Leonardo Pirro - Codemotion Rome 2018
Codemotion
 
Python programming computer science and engineering
Python programming computer science and engineeringPython programming computer science and engineering
Python programming computer science and engineering
IRAH34
 
Bioinformatica p6-bioperl
Bioinformatica p6-bioperlBioinformatica p6-bioperl
Bioinformatica p6-bioperl
Prof. Wim Van Criekinge
 
Jedi Slides Intro2 Chapter12 Advanced Io Streams
Jedi Slides Intro2 Chapter12 Advanced Io StreamsJedi Slides Intro2 Chapter12 Advanced Io Streams
Jedi Slides Intro2 Chapter12 Advanced Io Streams
Don Bosco BSIT
 

Similar to What's in a language? By Cheng Lou (20)

F# for C# Programmers
F# for C# ProgrammersF# for C# Programmers
F# for C# Programmers
 
Declarative Development Using Annotations In PHP
Declarative Development Using Annotations In PHPDeclarative Development Using Annotations In PHP
Declarative Development Using Annotations In PHP
 
Declarative Development Using Annotations In PHP
Declarative Development Using Annotations In PHPDeclarative Development Using Annotations In PHP
Declarative Development Using Annotations In PHP
 
Student DATABASE MANAGeMEnT SysTEm
Student DATABASE MANAGeMEnT SysTEmStudent DATABASE MANAGeMEnT SysTEm
Student DATABASE MANAGeMEnT SysTEm
 
Desarrollando aplicaciones web en minutos
Desarrollando aplicaciones web en minutosDesarrollando aplicaciones web en minutos
Desarrollando aplicaciones web en minutos
 
AST Transformations at JFokus
AST Transformations at JFokusAST Transformations at JFokus
AST Transformations at JFokus
 
Python slide
Python slidePython slide
Python slide
 
Swift - Modern & Expressive, or Magical Unicorn?
Swift  - Modern & Expressive, or Magical Unicorn?Swift  - Modern & Expressive, or Magical Unicorn?
Swift - Modern & Expressive, or Magical Unicorn?
 
Demystifying Object-Oriented Programming - Midwest PHP
Demystifying Object-Oriented Programming - Midwest PHPDemystifying Object-Oriented Programming - Midwest PHP
Demystifying Object-Oriented Programming - Midwest PHP
 
Fantom and Tales
Fantom and TalesFantom and Tales
Fantom and Tales
 
Programming Under Linux In Python
Programming Under Linux In PythonProgramming Under Linux In Python
Programming Under Linux In Python
 
Kotlin intro
Kotlin introKotlin intro
Kotlin intro
 
Postobjektové programovanie v Ruby
Postobjektové programovanie v RubyPostobjektové programovanie v Ruby
Postobjektové programovanie v Ruby
 
Java for beginners
Java for beginnersJava for beginners
Java for beginners
 
Object-oriented Programming-with C#
Object-oriented Programming-with C#Object-oriented Programming-with C#
Object-oriented Programming-with C#
 
Bioinformatics p5-bioperl v2013-wim_vancriekinge
Bioinformatics p5-bioperl v2013-wim_vancriekingeBioinformatics p5-bioperl v2013-wim_vancriekinge
Bioinformatics p5-bioperl v2013-wim_vancriekinge
 
Meetup di GDG Italia - Leonardo Pirro - Codemotion Rome 2018
Meetup di GDG Italia - Leonardo Pirro -  Codemotion Rome 2018 Meetup di GDG Italia - Leonardo Pirro -  Codemotion Rome 2018
Meetup di GDG Italia - Leonardo Pirro - Codemotion Rome 2018
 
Python programming computer science and engineering
Python programming computer science and engineeringPython programming computer science and engineering
Python programming computer science and engineering
 
Bioinformatica p6-bioperl
Bioinformatica p6-bioperlBioinformatica p6-bioperl
Bioinformatica p6-bioperl
 
Jedi Slides Intro2 Chapter12 Advanced Io Streams
Jedi Slides Intro2 Chapter12 Advanced Io StreamsJedi Slides Intro2 Chapter12 Advanced Io Streams
Jedi Slides Intro2 Chapter12 Advanced Io Streams
 

More from React London 2017

A Tiny Fiber Renderer by Dustan Kasten
A Tiny Fiber Renderer by Dustan Kasten A Tiny Fiber Renderer by Dustan Kasten
A Tiny Fiber Renderer by Dustan Kasten
React London 2017
 
Snapshot testing by Anna Doubkova
Snapshot testing by Anna Doubkova Snapshot testing by Anna Doubkova
Snapshot testing by Anna Doubkova
React London 2017
 
Next.js in production by Jasdeep Lalli
Next.js in production by Jasdeep Lalli Next.js in production by Jasdeep Lalli
Next.js in production by Jasdeep Lalli
React London 2017
 
The road to &lt;> styled-components: CSS in component-based systems by Max S...
The road to &lt;> styled-components: CSS in component-based systems by Max S...The road to &lt;> styled-components: CSS in component-based systems by Max S...
The road to &lt;> styled-components: CSS in component-based systems by Max S...
React London 2017
 
Logux, a new approach to client-server communication by Andrey Sitnik
Logux, a new approach to client-server communication by Andrey SitnikLogux, a new approach to client-server communication by Andrey Sitnik
Logux, a new approach to client-server communication by Andrey Sitnik
React London 2017
 
Weapons grade React by Ken Wheeler
Weapons grade React by Ken Wheeler Weapons grade React by Ken Wheeler
Weapons grade React by Ken Wheeler
React London 2017
 
Offline For The Greater Good by Jani Eväkallio
Offline For The Greater Good by Jani EväkallioOffline For The Greater Good by Jani Eväkallio
Offline For The Greater Good by Jani Eväkallio
React London 2017
 
Realtime Webpack - Pushing on-demand bundling to the limits by Oliver Woodings
Realtime Webpack - Pushing on-demand bundling to the limits by Oliver Woodings Realtime Webpack - Pushing on-demand bundling to the limits by Oliver Woodings
Realtime Webpack - Pushing on-demand bundling to the limits by Oliver Woodings
React London 2017
 
JavaScript Code Formatting With Prettier by Christopher Chedeau
JavaScript Code Formatting With Prettier by Christopher ChedeauJavaScript Code Formatting With Prettier by Christopher Chedeau
JavaScript Code Formatting With Prettier by Christopher Chedeau
React London 2017
 

More from React London 2017 (9)

A Tiny Fiber Renderer by Dustan Kasten
A Tiny Fiber Renderer by Dustan Kasten A Tiny Fiber Renderer by Dustan Kasten
A Tiny Fiber Renderer by Dustan Kasten
 
Snapshot testing by Anna Doubkova
Snapshot testing by Anna Doubkova Snapshot testing by Anna Doubkova
Snapshot testing by Anna Doubkova
 
Next.js in production by Jasdeep Lalli
Next.js in production by Jasdeep Lalli Next.js in production by Jasdeep Lalli
Next.js in production by Jasdeep Lalli
 
The road to &lt;> styled-components: CSS in component-based systems by Max S...
The road to &lt;> styled-components: CSS in component-based systems by Max S...The road to &lt;> styled-components: CSS in component-based systems by Max S...
The road to &lt;> styled-components: CSS in component-based systems by Max S...
 
Logux, a new approach to client-server communication by Andrey Sitnik
Logux, a new approach to client-server communication by Andrey SitnikLogux, a new approach to client-server communication by Andrey Sitnik
Logux, a new approach to client-server communication by Andrey Sitnik
 
Weapons grade React by Ken Wheeler
Weapons grade React by Ken Wheeler Weapons grade React by Ken Wheeler
Weapons grade React by Ken Wheeler
 
Offline For The Greater Good by Jani Eväkallio
Offline For The Greater Good by Jani EväkallioOffline For The Greater Good by Jani Eväkallio
Offline For The Greater Good by Jani Eväkallio
 
Realtime Webpack - Pushing on-demand bundling to the limits by Oliver Woodings
Realtime Webpack - Pushing on-demand bundling to the limits by Oliver Woodings Realtime Webpack - Pushing on-demand bundling to the limits by Oliver Woodings
Realtime Webpack - Pushing on-demand bundling to the limits by Oliver Woodings
 
JavaScript Code Formatting With Prettier by Christopher Chedeau
JavaScript Code Formatting With Prettier by Christopher ChedeauJavaScript Code Formatting With Prettier by Christopher Chedeau
JavaScript Code Formatting With Prettier by Christopher Chedeau
 

Recently uploaded

UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
DianaGray10
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
Pierluigi Pugliese
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
DianaGray10
 
Data structures and Algorithms in Python.pdf
Data structures and Algorithms in Python.pdfData structures and Algorithms in Python.pdf
Data structures and Algorithms in Python.pdf
TIPNGVN2
 
Large Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial ApplicationsLarge Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial Applications
Rohit Gautam
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
Matthew Sinclair
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
Alex Pruden
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Aggregage
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems S.M.S.A.
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
DianaGray10
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
Neo4j
 

Recently uploaded (20)

UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
 
Data structures and Algorithms in Python.pdf
Data structures and Algorithms in Python.pdfData structures and Algorithms in Python.pdf
Data structures and Algorithms in Python.pdf
 
Large Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial ApplicationsLarge Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial Applications
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
 

What's in a language? By Cheng Lou

  • 1. (Taming the Meta-Language, Part 2) First-Class File
  • 2. A long long time ago...
  • 3. A long long time ago... // this prints 5 times print(1) print(2) print(3) print(4) print(5)
  • 4. A long long time ago... // this prints 11 times print(1) print(2) print(3) print(4) print(5) print(6) print(7) print(8) print(9) print(10) print(11)
  • 5. A long long time ago... // @pragma 2-10 print(2) print(3) print(4) print(5) print(6) print(7) print(8) print(9) print(10) // @end pragma 2-10
  • 6. A long long time ago... print(1)
  • 7. A long long time ago... for (i from 2 to 20) { print(i) }
  • 8. Motivation • Meta language, part 2 (concrete) • Single Reason/OCaml feature
  • 10. Ladder • data • function • ...? React Component? • ...??
  • 12. Ladder • data • function • ...? React Component? • ...?? • ...???
  • 16. • Module • Module type • Module function
  • 17. type profession = ... /* type */ let person1 = ... /* binding */ let getProfession person => ... /* function */
  • 18. type profession = ... let person1 = ... let getProfession person => ...
  • 19. module School = { /* <-- module */ type profession = ... let person1 = ... let getProfession person => ... };
  • 20. module School = { /* <-- module */ type profession = ... let person1 = ... let getProfession person => ... module GPA = {...} /* <-- nested module */ };
  • 21. module School = { /* <-- module */ type profession = ... let person1 = ... let getProfession person => ... module GPA = {...} /* <-- nested module */ }; let anotherPerson: School.profession = ...
  • 22. module BaseComponent = { let greeting = "Hello from base component"; let count = 10; }; module ActualComponent = { include BaseComponent; /* <-- JS object spread! */ let greeting = "Hello from actual component"; };
  • 23. // Generated by BUCKLESCRIPT VERSION 1.2.1, // PLEASE EDIT WITH CARE var BaseComponent = /* module */[ /* greeting */"Hello from base component", /* count */10 ]; var ActualComponent = /* module */[ /* count */10, /* greeting */"Hello from actual component" ]; module BaseComponent = { let greeting = "Hello from base component"; let count = 10; }; module ActualComponent = { include BaseComponent; /* <-- JS object spread! */ let greeting = "Hello from actual component"; };
  • 24. What Did We Push Down? • Disciplined "mixins"
  • 25. What Did We Push Down? • Disciplined "mixins" module BaseComponent = { let greeting = "Hello from base component"; let count = 10; }; module ActualComponent = { include BaseComponent; /* <-- JS object spread! */ let greeting = "Hello from actual component"; };
  • 26. What Did We Push Down? • Disciplined "mixins" module BaseComponent = { let greeting = "Hello from base component"; let count = 10; }; module ActualComponent = { include BaseComponent; /* <-- JS object spread! */ let greeting = "Hello from actual component"; };
  • 28. Every File Is a Module
  • 29. Every File Is a Module type profession = ... /* type */ let person1 = ... /* binding */ let getProfession person => ... /* function */
  • 30. Every File Is a Module module School = { type profession = ... let person1 = ... let getProfession person => ... };
  • 31. Every File Is a Module /* school.re */ module School = { type profession = ... let person1 = ... let getProfession person => ... };
  • 32. Every File Is a Module /* school.re */ type profession = ... let person1 = ... let getProfession person => ...
  • 33. Every File Is a Module /* school.re */ type profession = ... let person1 = ... let getProfession person => ... /* agenda.re */ let p = School.person 1;
  • 34. Every File Is a Module /* school.re */ type profession = ... let person1 = ... let getProfession person => ... module GPA = {...} /* <-- nested module */ /* agenda.re */ let p = School.person 1;
  • 35. Every File Is a Module /* school.re */ module GPA = {...}; module Records = {...}; module Rooms = {...};
  • 36. Every File Is a Module /* a.re */ let a = 1; let b = 2; let c = 3; /* b.re */ include A;
  • 37. What Did We Push Down? • Code generation
  • 39. Module Type (Signature) module School = { type person = string; type people = list person; let peopleDatabase: people = ["Mary", "John", "joe"]; let addPerson (p: person) (database: people) => [p, ...database]; let sortPeopleAlphabetically (database: people) => ... };
  • 40. Module Type (Signature) module School = { type person = string; type people = list person; let peopleDatabase: people = ["Mary", "John", "joe"]; let addPerson (p: person) (database: people) => [p, ...database]; let sortPeopleAlphabetically (database: people) => ... };
  • 41. Module Type (Signature) module School = { type person = string; type people = list person; let peopleDatabase: people = ["Mary", "John", "joe"]; let addPerson (p: person) (database: people) => [p, ...database]; let sortPeopleAlphabetically (database: people) => ... };
  • 42. Module Type (Signature) module School = { type person = string; type people = list person; let peopleDatabase: people = ["Mary", "John", "joe"]; let addPerson (p: person) (database: people) => [p, ...database]; let sortPeopleAlphabetically (database: people) => ... };
  • 43. Module Type (Signature) module School = { type person = string; type people = list person; let peopleDatabase: people = ["Mary", "John", "joe"]; let addPerson (p: person) (database: people) => [p, ...database]; let sortPeopleAlphabetically (database: people) => ... };
  • 44. module School = { type person = string; type people = list person; let peopleDatabase: people = ["Mary", "John", "joe"]; let addPerson (p: person) (database: people) => [p, ...database]; let sortPeopleAlphabetically (database: people) => ... };
  • 45. module School = { type person = string; type people = list person; let peopleDatabase: people = ["Mary", "John", "joe"]; let addPerson (p: person) (database: people) => [p, ...database]; let sortPeopleAlphabetically (database: people) => ... }; { type person = string; type people = list person; let peopleDatabase: people; let addPerson: person => people => people; let sortPeopleAlphabetically: people => people; };
  • 46. module School: SchoolType = { type person = string; type people = list person; let peopleDatabase: people = ["Mary", "John", "joe"]; let addPerson (p: person) (database: people) => [p, ...database]; let sortPeopleAlphabetically (database: people) => ... }; module type SchoolType = { type person = string; type people = list person; let peopleDatabase: people; let addPerson: person => people => people; let sortPeopleAlphabetically: people => people; };
  • 47. • Module (Foo) -> normal file (foo.re) • Module type (Foo) -> ???
  • 48. • Module (Foo) -> normal file (foo.re) • Module type (Foo) -> interface file (foo.rei)
  • 49. What Did We Push Down? • formalized documentation
  • 50.
  • 51.
  • 52.
  • 53.
  • 54.
  • 55. module School: SchoolType = { type person = string; type people = list person; let peopleDatabase: people = ["Mary", "John", "joe"]; let addPerson (p: person) (database: people) => [p, ...database]; let sortPeopleAlphabetically (database: people) => ... }; module type SchoolType = { type person = string; type people = list person; let peopleDatabase: people; let addPerson: person => people => people; let sortPeopleAlphabetically: people => people; };
  • 56. module School: SchoolType = { type person = string; type people = list person; let peopleDatabase: people = ["Mary", "John", "joe"]; let addPerson (p: person) (database: people) => [p, ...database]; let sortPeopleAlphabetically (database: people) => ... }; module type SchoolType = { type person = string; type people = list person; let peopleDatabase: people; let addPerson: person => people => people; /* let sortPeopleAlphabetically: people => people; */ };
  • 57. module School: SchoolType = { type person = string; type people = list person; let peopleDatabase: people = ["Mary", "John", "joe"]; let addPerson (p: person) (database: people) => [p, ...database]; let sortPeopleAlphabetically (database: people) => ... }; module type SchoolType = { type person = string; type people = list person; let peopleDatabase: people; let addPerson: person => people => people; /* let sortPeopleAlphabetically: people => people; */ };
  • 59. Last Trick: abstract type • "Lots of languages have facilities for encapsulation, but not abstraction"
  • 60. Last Trick: abstract type module type SchoolType = { type person = string; type people = list person; let peopleDatabase: people; let addPerson: person => people => people; let sortPeopleAlphabetically: people => people; };
  • 61. Last Trick: abstract type module type SchoolType = { type person = string; type people = list person; let peopleDatabase: people; let addPerson: person => people => people; /* let sortPeopleAlphabetically: people => people; */ };
  • 62. Last Trick: abstract type module type SchoolType = { type person = string; type people = list person; let peopleDatabase: people; let addPerson: person => people => people; let sortPeopleAlphabetically: people => people; };
  • 63. Last Trick: abstract type module type SchoolType = { type person /* = string */; type people /* = list person */; let peopleDatabase: people; let addPerson: person => people => people; let sortPeopleAlphabetically: people => people; };
  • 64. Last Trick: abstract type module type SchoolType = { type person; type people; let peopleDatabase: people; let addPerson: person => people => people; let sortPeopleAlphabetically: people => people; };
  • 65. Last Trick: abstract type module type SchoolType = { type person; type people; let peopleDatabase: people; let addPerson: person => people => people; let sortPeopleAlphabetically: people => people; };
  • 66.
  • 67.
  • 68. What Did We Push Down? • Encapsulation: The implementation details stay implementation details React.__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED • Abstraction: nuance of breaking change migration paths
  • 69. What Did We Push Down? • Encapsulation: The implementation details stay implementation details React.__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED • Abstraction: nuance of breaking change migration paths
  • 71. Where Are We Going?