Multi-Stage Programming with Splice Variables

(tsung-ju.org)

32 points | by matt_d 6 hours ago

4 comments

  • perihelions
    1 hour ago
    How is this different from a syntactic macro?
    • burakemir
      53 minutes ago
      Two big differences:

        - it is typed, and
      
        - multi-stage programming can also describe runtime-code generation.
  • kldx
    2 hours ago
    > For example, instead of a power function that uses a loop, you could generate specialized code like x * x * x * x * x directly. This eliminates runtime overhead and creates highly optimized code.

    Could anyone explain to me how this is different from templates or parameter pack expansion in C++? I can see the constexpr-ness here is encoded in the type system and appears more composable, but I am not sure if I am missing the point.

    I looked at the paper but I can't find anything related to C++.

  • TimorousBestie
    5 hours ago
    This is fascinating. I could see it being very useful for writing SIMD abstraction layers (like Highway or SIMDe) without so much of the cruft.