Newspeak & its Children: Avarice and Sloth Gilad Bracha - - PowerPoint PPT Presentation

newspeak its children avarice and sloth
SMART_READER_LITE
LIVE PREVIEW

Newspeak & its Children: Avarice and Sloth Gilad Bracha - - PowerPoint PPT Presentation

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,


slide-1
SLIDE 1

Newspeak & its Children: Avarice and Sloth

Gilad Bracha Ministry of Truth

1 Thursday, June 11, 2009

slide-2
SLIDE 2

Functional Object- Oriented Programming

No contradiction FP is computational paradigm OO is an organizational one

2 Thursday, June 11, 2009

slide-3
SLIDE 3

FOOP is Spreading

OCaml/F# Scala

3 Thursday, June 11, 2009

slide-4
SLIDE 4

Pure FOOP

Purely Object-Oriented Purely Functional

4 Thursday, June 11, 2009

slide-5
SLIDE 5

Purely Object-Oriented

Everything is an Object

5 Thursday, June 11, 2009

slide-6
SLIDE 6

Purely Functional

HOFs Referentially transparent Lazy?

6 Thursday, June 11, 2009

slide-7
SLIDE 7

Newspeak Avarice Sloth

7 Thursday, June 11, 2009

slide-8
SLIDE 8

Newspeak

The “Mother of all sins” Mother and Sin share common OO structure

8 Thursday, June 11, 2009

slide-9
SLIDE 9

Newspeak

Message based No global scope

9 Thursday, June 11, 2009

slide-10
SLIDE 10

Message-based

All operations are “message sends” All names are late bound, depending

  • n their receiver

10 Thursday, June 11, 2009

slide-11
SLIDE 11

Program to an Interface not an Implementation

11 Thursday, June 11, 2009

slide-12
SLIDE 12

No References to Variables

Representation Independence

Always use slots via accessors

id = letter, (letter | digit) star.

12 Thursday, June 11, 2009

slide-13
SLIDE 13

No References to Classes

Always use accessors Classes are first class objects

Concepts are phenomena

13 Thursday, June 11, 2009

slide-14
SLIDE 14

No Global Scope

As in lambda calculus Newspeak is almost as simple as a class calculus

14 Thursday, June 11, 2009

slide-15
SLIDE 15

Ban Imports!

No packages, assemblies, modules, ... No imports, using clauses, ... Top level classes define modules

15 Thursday, June 11, 2009

slide-16
SLIDE 16

How does it work?

Tools provide any required top level namespace Aggregation makes parameterization manageable at top level Nesting handles the rest

16 Thursday, June 11, 2009

slide-17
SLIDE 17

Nested Classes

Nested as in Beta, not as in Java

Great for Modeling Natural Modularity Solution

17 Thursday, June 11, 2009

slide-18
SLIDE 18

Message-based Nested Classes

Classes are always virtual Classes are always mixins Class hierarchy inheritance

18 Thursday, June 11, 2009

slide-19
SLIDE 19

Practical Benefits

Side-by-side deployment Polymorphism over entire libraries Security

19 Thursday, June 11, 2009

slide-20
SLIDE 20

Security Implications

No Ambient Authority Object capability model Object reachability defines authority

20 Thursday, June 11, 2009

slide-21
SLIDE 21

Beyond Baked

21 Thursday, June 11, 2009

slide-22
SLIDE 22

Concurrency?

Actors Value types A slippery slope into Avarice and Sloth

22 Thursday, June 11, 2009

slide-23
SLIDE 23

Newspeak Avarice Sloth

23 Thursday, June 11, 2009

slide-24
SLIDE 24

Newspeak vs. Avarice

class Foo { | x y ::= 2 * x. z = y + 3. | } ...

24 Thursday, June 11, 2009

slide-25
SLIDE 25

Newspeak vs. Avarice

class Foo { | x y ::= 2 * x. z = y + 3. | } ...

25 Thursday, June 11, 2009

slide-26
SLIDE 26

Newspeak vs. Avarice

class Foo { | x = 0. y = 2 * x. z = y + 3. | } ...

26 Thursday, June 11, 2009

slide-27
SLIDE 27

Newspeak vs. Avarice

class Foo { || x = 0. y = 2 * x. z = y + 3. || } ...

27 Thursday, June 11, 2009

slide-28
SLIDE 28

Newspeak vs. Avarice

Eliminate mutable slot declarations Hide order of slot initialization Change libraries: Object identity Reflective modification Application libraries

28 Thursday, June 11, 2009

slide-29
SLIDE 29

Newspeak Avarice

Avarice is a proper subset of Newspeak

29 Thursday, June 11, 2009

slide-30
SLIDE 30

Avarice Sloth Same syntax, different semantics Applicative order Normal order

Avarice and Sloth:

30 Thursday, June 11, 2009

slide-31
SLIDE 31

Pattern Matching?

Only if we preserve data abstraction Everything is an object First class patterns and queries

31 Thursday, June 11, 2009

slide-32
SLIDE 32

Pluggable type system planned Type system is a priority - the lowest

  • ne

Non-trivial Classes, superclasses all dynamically bound

Typechecking?

32 Thursday, June 11, 2009

slide-33
SLIDE 33

Status

Available at http://newpeaklanguage.org

  • pen source under Apache 2.0 license

Work in Progress Expect some tweaks to syntax and semantics Implementation still not complete - especially libraries

33 Thursday, June 11, 2009

slide-34
SLIDE 34

Mirrors Self Strongtalk, JDI, APT ... See OOPSLA 04 No static Scala E

Connections

34 Thursday, June 11, 2009

slide-35
SLIDE 35

Security E (Miller 06) Java Modules Jigsaw, 1991 Units ML Fortress

Connections

35 Thursday, June 11, 2009

slide-36
SLIDE 36

Connections

Message-based programming Emerald, Trellis/Owl Smalltalk Self Virtual Types Beta, gBeta, Scala, CaesarJ, Tribe... Hierarchy inheritance: Ossher & Harrisson 92, Cook 89

36 Thursday, June 11, 2009

slide-37
SLIDE 37

Credits

Peter Ahe Vassili Bykov Yaron Kashai Bill Maddox Eliot Miranda

37 Thursday, June 11, 2009

slide-38
SLIDE 38

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.

38 Thursday, June 11, 2009