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

Macros page #5802

Merged
merged 16 commits into from
May 14, 2024
Merged

Macros page #5802

merged 16 commits into from
May 14, 2024

Conversation

MaryaBelanger
Copy link
Contributor

@MaryaBelanger MaryaBelanger commented May 10, 2024

@dart-github-bot
Copy link
Collaborator

dart-github-bot commented May 10, 2024

Visit the preview URL for this PR (updated for commit eaef097):

https://dart-dev--pr5802-macros-page-wlh7fieo.web.app

src/content/language/macros.md Outdated Show resolved Hide resolved
src/content/language/macros.md Outdated Show resolved Hide resolved
src/content/language/macros.md Outdated Show resolved Hide resolved
src/content/language/macros.md Outdated Show resolved Hide resolved
src/content/language/macros.md Outdated Show resolved Hide resolved
src/content/language/macros.md Outdated Show resolved Hide resolved
src/content/language/macros.md Outdated Show resolved Hide resolved
And also far more efficient, and far less error prone, than manually
writing solutions to these types of problems yourself.

Check out these examples showing the same JSON serialization
Copy link
Member

Choose a reason for hiding this comment

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

We should probably move this code over to something more stable than if we are going to link to it. But could also just grab the main.dart parts and inline them here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I did try adding them here using tabs to flip between, but it was pretty clunky. I can experiment with that again but I'll do it after this gets merged for the sake of time, and I'll comment this out for the time being

Copy link
Member

Choose a reason for hiding this comment

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

OK, yeah let's just skip this part for now

src/content/language/macros.md Show resolved Hide resolved
The macros language feature is not stable and currently behind an [experiment flag][].
Functionality is highly subject to change. This section will remain very high-level until stable.
:::

Copy link
Member

Choose a reason for hiding this comment

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

One of the key things that's really cool about Dart's macro system vs other ones (like Swift) is how expansive our support for introspection (looking at the surrounding source code). I think we should capture that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not really sure how to elaborate on this. If it goes in the "How it works" section then maybe we should give a small high-level example of introspection? Or, I could include it at the top of the bullet list under "The macros language feature"?

Copy link
Member

Choose a reason for hiding this comment

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

We can add this later.

@mit-mit
Copy link
Member

mit-mit commented May 13, 2024

Thanks so much Marya, this is shaping up very nicely!

@atsansone atsansone added the review.await-update Awaiting Updates after Edits label May 13, 2024
Copy link
Member

@mit-mit mit-mit left a comment

Choose a reason for hiding this comment

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

A few last changes. I think we can merge after these are done.

src/content/language/macros.md Outdated Show resolved Hide resolved
src/content/language/macros.md Outdated Show resolved Hide resolved
src/content/language/macros.md Outdated Show resolved Hide resolved
src/content/language/macros.md Show resolved Hide resolved
src/content/language/macros.md Outdated Show resolved Hide resolved
5. Run your project with the experiment flag:

```console
dart --enable-experiment=macros run bin/my_app.dart
Copy link
Member

Choose a reason for hiding this comment

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

We usually use dart run --enable-experiment=macros not dart --enable-experiment=macros run . I'm not sure it makes a difference, but just to make sure better to change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It says the flag has to come first in the macro readme, but I've found that dart run --enable-experiment=macros works fine

how a macros works, or to inspect the details of what it offers.

Click on the "**Go to Augmentation**" link that appears under the annotation
in your IDE (supported in VSCode and IntelliJ)
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we have it completed (or at least not tested) in IntelliJ. I think we should state just VSCode for now, and then offline hear if IntelliJ should be added.

Copy link
Member

@parlough parlough left a comment

Choose a reason for hiding this comment

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

Approving so you can land when you are ready. Do try to address mit's feedback if you have a chance. Thanks @MaryaBelanger!

@MaryaBelanger MaryaBelanger merged commit aaa637b into main May 14, 2024
10 checks passed
@parlough parlough deleted the macros-page branch May 24, 2024 21:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
review.await-update Awaiting Updates after Edits
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[3.4] Macros experiment page
6 participants