Newspeak & its Children: Avarice and Sloth Gilad Bracha Ministry of Truth Thursday, June 11, 2009 1
Functional Object- Oriented Programming No contradiction FP is computational paradigm OO is an organizational one Thursday, June 11, 2009 2
FOOP is Spreading OCaml/F# Scala Thursday, June 11, 2009 3
Pure FOOP Purely Object-Oriented Purely Functional Thursday, June 11, 2009 4
Purely Object-Oriented Everything is an Object Thursday, June 11, 2009 5
Purely Functional HOFs Referentially transparent Lazy? Thursday, June 11, 2009 6
Newspeak Avarice Sloth Thursday, June 11, 2009 7
Newspeak The “Mother of all sins” Mother and Sin share common OO structure Thursday, June 11, 2009 8
Newspeak Message based No global scope Thursday, June 11, 2009 9
Message-based All operations are “message sends” All names are late bound, depending on their receiver Thursday, June 11, 2009 10
Program to an Interface not an Implementation Thursday, June 11, 2009 11
No References to Variables Representation Independence Always use slots via accessors id = letter, (letter | digit) star. Thursday, June 11, 2009 12
No References to Classes Always use accessors Classes are first class objects Concepts are phenomena Thursday, June 11, 2009 13
No Global Scope As in lambda calculus Newspeak is almost as simple as a class calculus Thursday, June 11, 2009 14
Ban Imports! No packages, assemblies, modules, ... No imports, using clauses, ... Top level classes define modules Thursday, June 11, 2009 15
How does it work? Tools provide any required top level namespace Aggregation makes parameterization manageable at top level Nesting handles the rest Thursday, June 11, 2009 16
Nested Classes Nested as in Beta, not as in Java Great for Modeling Natural Modularity Solution Thursday, June 11, 2009 17
Message-based Nested Classes Classes are always virtual Classes are always mixins Class hierarchy inheritance Thursday, June 11, 2009 18
Practical Benefits Side-by-side deployment Polymorphism over entire libraries Security Thursday, June 11, 2009 19
Security Implications No Ambient Authority Object capability model Object reachability defines authority Thursday, June 11, 2009 20
Beyond Baked Thursday, June 11, 2009 21
Concurrency? Actors Value types A slippery slope into Avarice and Sloth Thursday, June 11, 2009 22
Newspeak Avarice Sloth Thursday, June 11, 2009 23
Newspeak vs. Avarice class Foo { | x y ::= 2 * x. z = y + 3. | } ... Thursday, June 11, 2009 24
Newspeak vs. Avarice class Foo { | x y ::= 2 * x. z = y + 3. | } ... Thursday, June 11, 2009 25
Newspeak vs. Avarice class Foo { | x = 0. y = 2 * x. z = y + 3. | } ... Thursday, June 11, 2009 26
Newspeak vs. Avarice class Foo { || x = 0. y = 2 * x. z = y + 3. || } ... Thursday, June 11, 2009 27
Newspeak vs. Avarice Eliminate mutable slot declarations Hide order of slot initialization Change libraries: Object identity Reflective modification Application libraries Thursday, June 11, 2009 28
Avarice is a proper subset of Newspeak Newspeak Avarice Thursday, June 11, 2009 29
Avarice and Sloth: Same syntax, different semantics Avarice Sloth Applicative order Normal order Thursday, June 11, 2009 30
Pattern Matching? Only if we preserve data abstraction Everything is an object First class patterns and queries Thursday, June 11, 2009 31
Typechecking? Pluggable type system planned Type system is a priority - the lowest one Non-trivial Classes, superclasses all dynamically bound Thursday, June 11, 2009 32
Status Available at http://newpeaklanguage.org open source under Apache 2.0 license Work in Progress Expect some tweaks to syntax and semantics Implementation still not complete - especially libraries Thursday, June 11, 2009 33
Connections Mirrors Self Strongtalk, JDI, APT ... See OOPSLA 04 No static Scala E Thursday, June 11, 2009 34
Connections Security E (Miller 06) Java Modules Jigsaw, 1991 Units ML Fortress Thursday, June 11, 2009 35
Connections Message-based programming Emerald, Trellis/Owl Smalltalk Self Virtual Types Beta, gBeta, Scala, CaesarJ, Tribe... Hierarchy inheritance: Ossher & Harrisson 92, Cook 89 Thursday, June 11, 2009 36
Credits Peter Ahe Vassili Bykov Yaron Kashai Bill Maddox Eliot Miranda Thursday, June 11, 2009 37
This file is licensed under the Creative Commons Attribution ShareAlike 3.0 License. In short: you are free to share and make derivative works of the file under the conditions that you appropriately attribute it, and that you distribute it only under a license identical to this one. Official license . The Newspeak eye used in the bullets, slide background etc. was designed by Victoria Bracha and is used by permission. Thursday, June 11, 2009 38
Recommend
More recommend