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

Sweet Macros O’ Mine

Sweet Macros O’ Mine

A simple ~10 minutes pitch on which I share a few thoughts about extending languages by taking advantage of macros and my experience playing with Sweet.js.

829e745fc00d15823f96bffb92577d51?s=128

Matheus Albuquerque

December 20, 2016
Tweet

More Decks by Matheus Albuquerque

Other Decks in Programming

Transcript

  1. Sweet Macros O’ Mine @ythecombinator #dev-schoolls

  2. [Small Bites] Matheus

  3. None
  4. None
  5. None
  6. • Instance and type methods • Computed instance and computed

    type properties • Initializers • Subscripts • Conformance to a protocol
  7. None
  8. Macros

  9. Small things that can syntactically parse and transform code around

    them.
  10. None
  11. .h file .m file .swift file

  12. 1.opens up a text file; 2.does a search-and-replace process; 3.saves.

  13. None
  14. functions that WORK OVER ASTs.

  15. None
  16. Sweet Macros O’ Mine

  17. None
  18. Macros for languages that have a lot of special syntax

    take advantage of pattern matching.
  19. None
  20. ma o definiti k w d

  21. a new v iable the c t block scope

  22. st pa рn

  23. sec d pa рn

  24. vok g

  25. None
  26. None
  27. None
  28. None
  29. None
  30. None
  31. All macros in sweet.js are fully hygienic, which means that

    identifiers always reference the correct thing.
  32. And so?

  33. https://github.com/oleiman/sweet-contracts

  34. https://github.com/srikumarks/cspjs

  35. https://github.com/natefaubion/sparkler

  36. https://github.com/siren-lang/siren

  37. https://github.com/sweet-js/sweet.js/wiki/ Example-macros

  38. Are macros sexy?

  39. None
  40. None
  41. What if we stopped creating compile-to-JS languages and started recreating

    JS?
  42. THANKS. @ythecombinator #dev-schoolls

  43. THANKS. @ythecombinator #dev-schoolls