Save 37% off PRO during our Black Friday Sale! »

The Taming of the Deftype

The Taming of the Deftype

Slides from a talk I presented at Clojure/West 2012, San Jose, CA.

8aa4490274249db8981283bdadb2ec2b?s=128

Baishampayan Ghose

May 11, 2012
Tweet

Transcript

  1. deftype the taming of the Baishampayan “BG” Ghose @ghoseb Clojure/West

    2012 Friday 16 March 12
  2. @ghoseb helpshift.com Friday 16 March 12

  3. @ghoseb helpshift.com I caught a dead mouse in the office

    the other day Friday 16 March 12
  4. MOTIVATION Friday 16 March 12

  5. Friday 16 March 12

  6. Friday 16 March 12

  7. Maps Friday 16 March 12

  8. Records Friday 16 March 12

  9. Types Friday 16 March 12

  10. TO SUMMARIZE Friday 16 March 12

  11. deftype Performance Collection Abstractions Named Type Mutable Fields Full Control

    Friday 16 March 12
  12. defrecord Performance Collection Abstractions Named Type HashMap Semantics * Friday

    16 March 12
  13. maps Every other use-case Friday 16 March 12

  14. IN SHORT Friday 16 March 12

  15. Use Maps! Friday 16 March 12

  16. Dive into deftype Friday 16 March 12

  17. Use the source, Luke! Friday 16 March 12

  18. IPersistentMap Seqable Associative IPersistentCollection ILookup Counted IFn IPersistentSet IObj Object

    IMeta IPersistentStack Indexed IPersistentVector Friday 16 March 12
  19. IPersistentMap Seqable Associative IPersistentCollection ILookup Counted IFn IPersistentSet IObj Object

    IMeta IPersistentStack Indexed IPersistentVector Friday 16 March 12
  20. Friday 16 March 12

  21. Scaffold Friday 16 March 12

  22. ‘scaffold’ by Christophe Grand Friday 16 March 12

  23. } Interface we want Ancestor interface Method sigs. . .

    . . . . . Friday 16 March 12
  24. bit.ly/clj-scaffold steal this code! Friday 16 March 12

  25. A Note About IFn Holy arities, Batman! Friday 16 March

    12
  26. A Note About IFn Should implement all to avoid non-helpful

    exception. Friday 16 March 12
  27. MUTABLE TYPES Friday 16 March 12

  28. ^:volatile-mutable ^:unsynchronized-mutable atomic reads & writes a ‘vanilla’ Java mutable

    field Friday 16 March 12
  29. Friday 16 March 12

  30. Printing Friday 16 March 12

  31. clojure.core/print-method for humans Friday 16 March 12

  32. clojure.core/print-dup for the reader Friday 16 March 12

  33. #mylib.core.MyType[1,2,3] Object Literal Reader Syntax Friday 16 March 12

  34. Factory Functions Friday 16 March 12

  35. Hide Implementation Details Avoid Importing Java Classes Friday 16 March

    12
  36. (my-type :foo :bar) (import myns.MyType) (MyType. [:foo :bar]) vs. Friday

    16 March 12
  37. AN EXAMPLE IMPLEMENTATION (a weekend hack) Friday 16 March 12

  38. bit.ly/clj-chainmap steal this code! Friday 16 March 12

  39. Fin Friday 16 March 12

  40. Friday 16 March 12