Skip to content

Instantly share code, notes, and snippets.

@Xliff
Created July 9, 2024 21:34
Show Gist options
  • Save Xliff/aa252e991b97ba4f7fd0693cf3e9e6f1 to your computer and use it in GitHub Desktop.
Save Xliff/aa252e991b97ba4f7fd0693cf3e9e6f1 to your computer and use it in GitHub Desktop.
Reusable Code as Macros in Raku

I'm trying to write a generic macro that can produce code like the following:

method setAppName ($name) {
  $appName = $name;
  self.Applications::Bizzell::Inventory::Roles::DB::Threshold::setAppName(
    $name
  );
}
method appName { $appName }

Can someone help me convert this into a macro? I'd rather have to replace macros (as experital as those are) with the raw code as I'd rather have to refactor one place, rather than 50.

TIA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment