Newspeak:
Evolving Smalltalk for
the Age of the Net
Gilad Bracha
Distinguished Engineer
Cadence Design Systems
Genealogy of Newspeak
Smalltalk
Newspeak
Self Beta
Scala
Goals and Principles
Goals
Modularity
Security
Interoperability
Design Principle: Message based
Programming
Message-based
Programming
Smalltalk should have been message-oriented
- Alan Kay
Every run time operation is a message
send.
Message-based
Programming
In Smalltalk
t := Array new: n.
^t
In Smalltalk
t := Array new: n.
^t
In Smalltalk
t := Array new: n.
^t
assignment
In Smalltalk
t := Array new: n.
^t
Globalassignment
In Smalltalk
t := Array new: n.
^t
Global
temp/arg
assignment
In Smalltalk
t := Array new: n.
^t
Global
inst var
temp/arg
assignment
In Smalltalk, using
messages
self t: (self Array new: (self n)).
^self t
In Smalltalk, using
messages
self t: (self Array new: (self n)).
^self t
Implicit receivers
t: (Array new: n).
^t
In Newspeak
t:: Array new: n.
^t
In Smalltalk, using
messages
self t: (self Array new: (self n)).
^self t
In Smalltalk
t := Array new: n.
^t
inst var
Representation
Independence
No code depends on our choice of
storage representation
Clients never depended on it in Smallt...
In Smalltalk
t := Array new: n.
^t
Global
No Static
No globals, no class variables, no pool
variables of any kind; no class instance
variables
Good for
Distribution
Re-entrancy
Testing
Startup
Memory management
Security
No Static
Goals
Modularity
Security
Interoperability
Object-capability model (Miller06)
Object reachability defines authority
No static state
No Ambient Authority
Objects as Ca...
Object-capability model (Miller06)
Object reachability defines authority
No static state
No Ambient Authority
Access contro...
Access Control
In Smalltalk, the only means of data hiding
are instance variables & blocks
Messages are always public
If e...
Mirror based Reflection
Mirrors act as capabilities for reflection
Availability of reflection can be controlled
For security
...
Where does the state go?
No Static State
No Static State
How do different objects
conveniently share state?
No Static State
How do different objects
conveniently share state?
Via shared lexical scope
Nested Classes
Nested as in Beta, not as in
Java
Great for Modeling
Natural Modularity Solution
Goals
Modularity
Security
Interoperability
No References to Classes
Always use accessors
Classes are first class objects
Classes are always virtual
Classes are always...
External Dependencies
are Explicit
Module definition = Class not nested within
another class
No access to surrounding names...
Modules are Sandboxes
Factory method parameters are objects/
capabilities that determine per-module sandbox
Side by Side
Module definitions are instantiated into
stateful objects known as modules
Easy to create multiple instances, ...
Modules are Re-entrant
Module definitions are deeply immutable
Modules cannot step on each other’s state
Multiple Implementations
Modules are objects, accessed via their
protocol
Different implementations can co-exist
Module definitions are objects
Instantiate module in deeply immutable
object literal’s main: method
Deployment amounts to o...
Goals
Modularity
Security
Interoperability
Smalltalk has Primitive
Features
Alberto Salguero
primFree: address
<primitive: 'primFree'
error: errorCode
module: 'IA32A...
Smalltalk has Primitive
Features
Alberto Salguero
primFree: address
<primitive: 'primFree'
error: errorCode
module: 'IA32A...
Smalltalk has Primitive
Features
primFree: address
<primitive: 'primFree'
error: errorCode
module: 'IA32ABI'>

 ^self prim...
Smalltalk has Primitive
Features
primFree: address
<primitive: 'primFree'
error: errorCode
module: 'IA32ABI'>

 ^self prim...
Nothing Primitive about
Newspeak
There is no “primitive” construct in
Newspeak - contradicts message-based
philosophy
Inst...
Primitives & Foreign calls
In many languages, primitives are just
foreign calls
These notions are distinct
Primitives do n...
Primitives & Foreign calls
In most Smalltalks, foreign calls are
variations of primitives
They therefore inherit
Ugliness
...
Aliens
In Newspeak, calling out is achieved by
sending messages to alien objects
You can send blocks as arguments to
imple...
Portable Native GUI
The Age of the Net
Cloud Computing
The Age of the Net
Cloud Computing
The Age of the Net
Cloud Computing
Software delivery and maintenance over
the net
Javascript is the assembly language of t...
The Age of the Net
Back to 1970s timesharing or 1990 X-
terminals?
System software has to be local
UI issues
Depend on Reliable, Fast, Cheap Network
Make you “reboot” - it’s called: session...
Combine advantages of web services and
traditional client applications
Always Available (even w/o network)
Always Up to da...
Maintains software and data on server
Provides backup, audit trail, software
distribution & maintenance
Software distribut...
Hotswapping: Running applications can be
updated on-the-fly over the network
Modules: well defined units of deployment
and u...
Work in Progress
Expect some tweaks to syntax and
semantics
Implementation still incomplete -
especially libraries
Working...
Libraries
System issues: Linux & Mac Native GUI,
FFI refinements
Concurrency: value types, actors
Orthogonal synchronizatio...
Message-based programming
Component style modularity
Virtual classes, mixins, class hierarchy
inheritance
Object capabilit...
Mirror based reflection
Actor style concurrency
Pluggable types
Synergy
Credits
Peter Ahe
Vassili Bykov
Yaron Kashai
Eliot Miranda (emeritus)
This file is licensed under the Creative Commons
Attribution ShareAlike 3.0 License. In short: you are
free to share and ma...
Upcoming SlideShare
Loading in …5
×

Newspeak: Evolving Smalltalk for the Age of the Net

1,432 views

Published on

Newspeak:
Evolving Smalltalk for the Age of the Net. Gilad Bracha. ESUG 2008, Amsterdam

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,432
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
14
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Newspeak: Evolving Smalltalk for the Age of the Net

  1. 1. Newspeak: Evolving Smalltalk for the Age of the Net Gilad Bracha Distinguished Engineer Cadence Design Systems
  2. 2. Genealogy of Newspeak Smalltalk Newspeak Self Beta Scala
  3. 3. Goals and Principles Goals Modularity Security Interoperability Design Principle: Message based Programming
  4. 4. Message-based Programming Smalltalk should have been message-oriented - Alan Kay
  5. 5. Every run time operation is a message send. Message-based Programming
  6. 6. In Smalltalk t := Array new: n. ^t
  7. 7. In Smalltalk t := Array new: n. ^t
  8. 8. In Smalltalk t := Array new: n. ^t assignment
  9. 9. In Smalltalk t := Array new: n. ^t Globalassignment
  10. 10. In Smalltalk t := Array new: n. ^t Global temp/arg assignment
  11. 11. In Smalltalk t := Array new: n. ^t Global inst var temp/arg assignment
  12. 12. In Smalltalk, using messages self t: (self Array new: (self n)). ^self t
  13. 13. In Smalltalk, using messages self t: (self Array new: (self n)). ^self t
  14. 14. Implicit receivers t: (Array new: n). ^t
  15. 15. In Newspeak t:: Array new: n. ^t
  16. 16. In Smalltalk, using messages self t: (self Array new: (self n)). ^self t
  17. 17. In Smalltalk t := Array new: n. ^t inst var
  18. 18. Representation Independence No code depends on our choice of storage representation Clients never depended on it in Smalltalk Now subclasses don’t depend on it either Even the class itself doesn’t
  19. 19. In Smalltalk t := Array new: n. ^t Global
  20. 20. No Static No globals, no class variables, no pool variables of any kind; no class instance variables
  21. 21. Good for Distribution Re-entrancy Testing Startup Memory management Security No Static
  22. 22. Goals Modularity Security Interoperability
  23. 23. Object-capability model (Miller06) Object reachability defines authority No static state No Ambient Authority Objects as Capabilities
  24. 24. Object-capability model (Miller06) Object reachability defines authority No static state No Ambient Authority Access control Objects as Capabilities
  25. 25. Access Control In Smalltalk, the only means of data hiding are instance variables & blocks Messages are always public If everything is a message send, everything is public Public, protected and private messages
  26. 26. Mirror based Reflection Mirrors act as capabilities for reflection Availability of reflection can be controlled For security For deployment
  27. 27. Where does the state go? No Static State
  28. 28. No Static State How do different objects conveniently share state?
  29. 29. No Static State How do different objects conveniently share state? Via shared lexical scope
  30. 30. Nested Classes Nested as in Beta, not as in Java Great for Modeling Natural Modularity Solution
  31. 31. Goals Modularity Security Interoperability
  32. 32. No References to Classes Always use accessors Classes are first class objects Classes are always virtual Classes are always mixins Class hierarchy inheritance
  33. 33. External Dependencies are Explicit Module definition = Class not nested within another class No access to surrounding namespace All names locally declared or inherited
  34. 34. Modules are Sandboxes Factory method parameters are objects/ capabilities that determine per-module sandbox
  35. 35. Side by Side Module definitions are instantiated into stateful objects known as modules Easy to create multiple instances, with different parameters
  36. 36. Modules are Re-entrant Module definitions are deeply immutable Modules cannot step on each other’s state
  37. 37. Multiple Implementations Modules are objects, accessed via their protocol Different implementations can co-exist
  38. 38. Module definitions are objects Instantiate module in deeply immutable object literal’s main: method Deployment amounts to object serialization Start up app by deserializing and invoking main: Deployment
  39. 39. Goals Modularity Security Interoperability
  40. 40. Smalltalk has Primitive Features Alberto Salguero primFree: address <primitive: 'primFree' error: errorCode module: 'IA32ABI'> ^self primitiveFailed
  41. 41. Smalltalk has Primitive Features Alberto Salguero primFree: address <primitive: 'primFree' error: errorCode module: 'IA32ABI'> ^self primitiveFailed
  42. 42. Smalltalk has Primitive Features primFree: address <primitive: 'primFree' error: errorCode module: 'IA32ABI'> ^self primitiveFailed Are you proud when you explain this to a non-Smalltalker?
  43. 43. Smalltalk has Primitive Features primFree: address <primitive: 'primFree' error: errorCode module: 'IA32ABI'> ^self primitiveFailed What object is the receiver?
  44. 44. Nothing Primitive about Newspeak There is no “primitive” construct in Newspeak - contradicts message-based philosophy Instead, you send a message to theVM, as reified via aVM mirror VM mirror behavior should be standardized
  45. 45. Primitives & Foreign calls In many languages, primitives are just foreign calls These notions are distinct Primitives do not need to worry about marshaling Assumption thatVM is in another language is inappropriate
  46. 46. Primitives & Foreign calls In most Smalltalks, foreign calls are variations of primitives They therefore inherit Ugliness Lack of portability Often an afterthought
  47. 47. Aliens In Newspeak, calling out is achieved by sending messages to alien objects You can send blocks as arguments to implement call backs Different alien libraries can support different languages
  48. 48. Portable Native GUI
  49. 49. The Age of the Net Cloud Computing
  50. 50. The Age of the Net Cloud Computing
  51. 51. The Age of the Net Cloud Computing Software delivery and maintenance over the net Javascript is the assembly language of the internet, browser is the OS
  52. 52. The Age of the Net Back to 1970s timesharing or 1990 X- terminals?
  53. 53. System software has to be local UI issues Depend on Reliable, Fast, Cheap Network Make you “reboot” - it’s called: session expired Web Apps have Downsides
  54. 54. Combine advantages of web services and traditional client applications Always Available (even w/o network) Always Up to date Run locally, think globally Restart-free Network Serviced Applications
  55. 55. Maintains software and data on server Provides backup, audit trail, software distribution & maintenance Software distributed and updated when client syncs with server Client can run offline using locally cached software and data Sync does not imply application restart Network Software Service
  56. 56. Hotswapping: Running applications can be updated on-the-fly over the network Modules: well defined units of deployment and update Security: Object capability model Orthogonal Synchronization: Natural update of program and data* Platform Support for Network Serviced Applications
  57. 57. Work in Progress Expect some tweaks to syntax and semantics Implementation still incomplete - especially libraries Working toward public release to be open sourced under Apache 2.0 license Status
  58. 58. Libraries System issues: Linux & Mac Native GUI, FFI refinements Concurrency: value types, actors Orthogonal synchronization Object literals, Metadata,Access control, Pluggable Types Future Work
  59. 59. Message-based programming Component style modularity Virtual classes, mixins, class hierarchy inheritance Object capability model and security Synergy
  60. 60. Mirror based reflection Actor style concurrency Pluggable types Synergy
  61. 61. Credits Peter Ahe Vassili Bykov Yaron Kashai Eliot Miranda (emeritus)
  62. 62. 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 original Australopithecus skull image on slides 38/39 is the work of Albert Salguero and was licensed under a very similar license (version 2.5 of this license). The Newspeak eye used in the bullets, slide background etc. was designed by Victoria Bracha and is used by permission.

×