Classes in the Mist

1,879 views

Published on

A non-traditional Smalltalk gets classy

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,879
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Classes in the Mist

  1. 1. Martin is getting the projector to work with his laptop.
  2. 2. Classes in the Mist A Non- Traditional Smalltalk Gets Classy Martin McClure
  3. 3. There is no “I” in “Team”
  4. 4. There is no “C” in “Smalltalk”
  5. 5. Mist •Open-source (MIT) •mist-project.org (see previous videos) •Github
  6. 6. Status (overview)
  7. 7. Status (overview) Why Now?
  8. 8. Values •Self-sufficiency •Simplicity •Consistency •Speed •Craziness
  9. 9. Self-Sufficiency
  10. 10. Minimize Dependencies
  11. 11. Minimize Dependencies Maximize Interoperability
  12. 12. Simplicity
  13. 13. Consistency
  14. 14. Speed
  15. 15. Craziness
  16. 16. “If you aren't doing some things that are crazy, you're doing the wrong things” Larry Page, Google CEO
  17. 17. Values •Self-sufficiency •Simplicity •Consistency •Speed •Craziness
  18. 18. Strategies •Spend memory freely •Start simple •Broad solutions •Unconventional first •Go for the 80/20
  19. 19. Implementation
  20. 20. Initial Target X86_64 Linux
  21. 21. Mist compiles to Fog compiles to machine code
  22. 22. Primitives are written directly in Fog
  23. 23. Executable image
  24. 24. Fully Dynamic
  25. 25. Object Headers
  26. 26. Object Headers NO
  27. 27. Object Headers Instance Variables
  28. 28. Memory Management
  29. 29. Garbage Collection       gcMark       isGcMarked            ifFalse: [isGcMarked := true.                     self allReferencesDo:  [:each | each gcMark]]     gcSweep       isGcMarked         ifTrue: [isGcMarked := false]         ifFalse: [|size|                   size := self physicalSize.                   class := FreeSpace.                   self physicalSize: size.                   TheObjectManager                      add: self toFreeListForSize: size]
  30. 30. Tail Call Elimination
  31. 31. Loop using recursion SmallInteger   to: limit byPositive: increment do: aBlock     | nextIndex |     aBlock value: self.     nextIndex := self + increment.     ^ nextIndex > limit         ifFalse: [nextIndex                      to: limit                      byPositive: increment                      do: aBlock].
  32. 32. Loop with Tail Call Elimination SmallInteger   to: limit byPositive: increment do: aBlock     | nextIndex |     aBlock value: self.     nextIndex := self + increment.     ^ nextIndex > limit         ifFalse: [nextIndex                      to: limit                      byPositive: increment                      do: aBlock].
  33. 33. Loop with Tail Call Elimination False   ifFalse: aBlock     ^ aBlock value. <this block's closure class>   value     ^ nextIndex          to: limit          byPositive: increment          do: aBlock.
  34. 34. Language Features
  35. 35. Traits
  36. 36. Stateful Traits Name:   IdentityHash Instance Variables:   identityHash Methods:   identityHash     identityhash == nil       ifTrue: [identityHash := Random integer].   ^identityHash
  37. 37. Indexed instvars as a trait
  38. 38. Do you need both concepts?
  39. 39. Classes Compose...
  40. 40. ...but Do Not Inherit
  41. 41. Methods ● Compose as in traits ● Rename or omit on conflict ● Can declare private ● No super send ● Special behavior of self send
  42. 42. Instvars ● Private to defining class ● Name conflicts impossible ● Indexed instvars – some fussing needed
  43. 43. Abstract Class ● #basicNew not understood ● “class” instvar not present
  44. 44. Concrete Class ● Compose one concrete class ...and only one
  45. 45. Class Composition vs Object Composition
  46. 46. Modules
  47. 47. Variables ● Args and temps ● Instance variables ● Module variables – Class names ● Class variables? – Compile-time constants
  48. 48. Safety ● Privacy ● Teams
  49. 49. Massively Single- threaded
  50. 50. No String Literals
  51. 51. Stream Literals 'Name: [name] Address: [address]'
  52. 52. Status (detailed)
  53. 53. Classes in the Mist A Non- Traditional Smalltalk Gets Classy Martin McClure

×