Comment by owlstuffing

16 days ago

That strategy will backfire when the grammar changes in a later release. A pre-parse step is necessary for code that targets different compiler releases.

Now I'm confused, what do you mean? What grammar changes?

  • Imagine v2.0 introduces a new feature that requires a parser change—one that v1.0 wouldn't be able to parse.

      $if $defined(C3_V2_PLUS):  
          // new feature
          fn f = \ -> foo(); // this won't parse in v1.0
      $else
          Callback f = ...;
      $endif
    

    This is also an issue if a future version of C3 introduces language level support, allowing newer compilers to compile code as if it were written for an earlier version. While this approach works well when teams standardize on a specific version’s feature set, they may still want to take advantage of performance improvements in the latest compiler.

    That said, this is a niche case and not something I’d consider a dealbreaker.