-
Notifications
You must be signed in to change notification settings - Fork 704
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
Macros page #5802
Conversation
Visit the preview URL for this PR (updated for commit eaef097): |
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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
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. | ||
::: | ||
|
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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"?
There was a problem hiding this comment.
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.
Thanks so much Marya, this is shaping up very nicely! |
There was a problem hiding this 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
5. Run your project with the experiment flag: | ||
|
||
```console | ||
dart --enable-experiment=macros run bin/my_app.dart |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
src/content/language/macros.md
Outdated
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) |
There was a problem hiding this comment.
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.
There was a problem hiding this 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!
Staged here: https://dart-dev--pr5802-macros-page-wlh7fieo.web.app/language/macros
Fixes #5692