Podchaser Logo
Home
71: Macros ?

71: Macros ?

Released Thursday, 28th February 2019
Good episode? Give it some love!
71: Macros ?

71: Macros ?

71: Macros ?

71: Macros ?

Thursday, 28th February 2019
Good episode? Give it some love!
Rate Episode
  • bit of history

    Macros can be used to make tasks less repetitive by representing a complicated sequence of keystrokes, mouse movements, commands, or other types of input. In computer programming, macros are a tool that allows a developer to re-use code.

  • best explianation i have found so far

    Fundamentally, macros are a way of writing code that writes other code, which is known as metaprogramming. rust docs

  • macro is going to happen at compile time. where a function is going to happen at run time.

  • code that writes code. ? This is less readable, understandable, and maintainable then general functions.

Two types of macros
  1. Declaritive w/ general metaprogramming

    • Matching on patterns and replacing code
  2. Prodecural more like functions

    • given input -> producing output (pure)
  3. Problem babel macros sets to solve solution

    • They can lead to confusion because when looking at code in a project, you might not know that there’s a plugin transforming that code.
    • They have to be globally configured or configured out-of-band (in a .babelrc or webpack config).
    • They can conflict in very confusing ways due to the fact that all babel plugins run simultaneously (on a single walk of Babel’s AST).
  4. Solution

    • transformations with:
    • zero config
    • importability

Explicit is often a better pattern than implicit because it requires others to understand how things are globally configured. This is in this spirit are babel-plugin-macros designed. However, some things do need to be implicit, and those kinds of babel plugins can’t be turned into macros.

  • the idea of syntax macro it’s well suited for babel-plugin-macros
What would it take to enable JS Macros to open stage proposals to actual implementations?

TC-39 Proposals

Picks Resources

SweetJS

Follow

 

Show More
Rate

Join Podchaser to...

  • Rate podcasts and episodes
  • Follow podcasts and creators
  • Create podcast and episode lists
  • & much more

Episode Tags

Do you host or manage this podcast?
Claim and edit this page to your liking.
,

Unlock more with Podchaser Pro

  • Audience Insights
  • Contact Information
  • Demographics
  • Charts
  • Sponsor History
  • and More!
Pro Features