Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change the specified augmentation library structure for macros #3359

Merged
merged 3 commits into from
Sep 22, 2023

Conversation

jakemac53
Copy link
Contributor

@jakemac53 jakemac53 commented Sep 18, 2023

This moves us to a more user friendly format (all augmentations for a single type grouped together), and removes the incorrect statements about source offset stability.

Closes #3350

@jakemac53 jakemac53 added the static-metaprogramming Issues related to static metaprogramming label Sep 18, 2023
When there are multiple augmentations of the same type declaration, they are
merged into a single `augment <type> {}` block. This is easier for end users to
understand. This includes multiple augmentations of the _same_ declaration, they
should appear as separate declarations within the same type augmentation.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand what the first statement means. If there are two macros that augment a class A by adding methods foo and bar, we get a single augmentation.

augment class A {
  void foo() {}
  void bar() {}
}

I don't understand what the last statement means. Could you give an example?

Copy link
Contributor Author

@jakemac53 jakemac53 Sep 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The second example means if you are augmenting foo multiple times, we put those in the same augment <type> {} declaration:

augment class A {
  augment void foo() {}
  augment void foo() {}
  augment void foo() {}
  augment void foo() {}
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that the augmentation library proposal might need to be updated to explicitly allow this, I think it might be ambiguous today.

working/macros/feature-specification.md Show resolved Hide resolved
@jakemac53
Copy link
Contributor Author

I pushed several examples, and removed the existing example which was not actually relevant any longer (it was based on the appending strategy).

@jakemac53 jakemac53 merged commit 47a849e into main Sep 22, 2023
@jakemac53 jakemac53 deleted the augmentation-structure branch September 22, 2023 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
static-metaprogramming Issues related to static metaprogramming
Projects
Development

Successfully merging this pull request may close these issues.

Rework the augmentations library structure and ordering section for macros
3 participants