Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Seven Languages In Seven Weeks Part II

Seven Languages In Seven Weeks Part II

Frank Kair

Cheesecake Labs

May 28, 2018
Tweet

More Decks by Cheesecake Labs

Other Decks in Programming

Transcript

  1. • Ruby • Io • Prolog • Scala • Erlang

    • Clojure • Haskell Motivation
  2. Java has Garbage Collection (GC). Rust uses RAII (Resource Acquisition

    Is Initialization). Lifetime and scope based. Another example: Rust vs Java
  3. Swift can allocate memory both on the stack and on

    the heap. One more example: Swift
  4. Swift can allocate memory both on the stack and on

    the heap. Stack → Static, known size at compile time. One more example: Swift
  5. Swift can allocate memory both on the stack and on

    the heap. Stack → Static, known size at compile time. struct {}. One more example: Swift
  6. One more example: Swift Swift can allocate memory both on

    the stack and on the heap. Stack → Static, known size at compile time. Heap → Dynamic, unknown size at compile time, needs runtime to figure out object sizes.
  7. Question: We just discussed struct and class, which one of

    the two should support inheritance and overriding? One more example: Swift
  8. One more example: Swift Question: We just discussed struct and

    class, which one of the two should support inheritance and overriding? Note: Swift’s dynamics comes from Objective-C which was based on Smalltalk. Most of Swift’s modern flavors are now coming from static trends, such as Rust’s lifetime / RAII.
  9. In Objective-C we send a message to an object. We

    don’t call a function from an object. Objective-C Send
  10. • Open class • Eval • Simple example • Inspect

    • method_missing Ruby & Metaprogramming
  11. Ruby & Metaprogramming • Open class • Eval • Simple

    example • Inspect • method_missing • send
  12. Ruby & Metaprogramming • Open class • Eval • Simple

    example • Inspect • method_missing • send • define_method