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

[3.4] Macros experiment page #5692

Closed
MaryaBelanger opened this issue Apr 5, 2024 · 2 comments · Fixed by #5802
Closed

[3.4] Macros experiment page #5692

MaryaBelanger opened this issue Apr 5, 2024 · 2 comments · Fixed by #5802
Assignees
Labels
a.language Relates to the Dart language tour d.enhancement Improves docs with specific ask e2-days Can complete in < 5 days of normal, not dedicated, work meta.evaluation Need to consider what changes if any are needed p1-high Major but not urgent concern: Resolve in months. Update each month.

Comments

@MaryaBelanger
Copy link
Contributor

MaryaBelanger commented Apr 5, 2024

Plan for macros documentation work in the Dart 3.4 release.

Summary

A single json serialization macro will be in main (probably behind a flag) by the 3.4 release. The feature will be advertised alongside this release, so we'll create an "experiment" page for users to learn more from when they hear about the feature.

Users will not be able to write their own macros in the 3.4 stable release.

Goals

  • Introduce users to macros before the full implementation is complete.
  • Teach users how to use the new json serialization macro.
  • Showcase the cool features of macros and get users excited for the upcoming feature.
  • Be VERY clear this is not available yet
    • Main feature completely unavailable, loose/hopeful timeline
    • Example macro behind flag, how to try it out

Doc plan/eval

  • Create a page at dart.dev/language/macros
  • Hide from the side nav for now
  • Redirect temporary link: Create content and change redirect for dart.dev/macros #5685
  • Clear note at the top about availability / timeline (or lack thereof)
    • (from comment): direction on where to leave feedback (different repos, language, analyzer, specific issues? etc), what levels of feedback are welcome, etc
  • Introduce macros at a high-level, how they work (feature as planned), why they're cool
    • General flow: custom macro, configurations, diagnostics, using a macro, generated augmentation, etc.
    • User experience improvements over other codegen:
      • integrated into Dart, don't have to run anything separate
      • no referencing weird generated symbols, things get added directly
      • significantly faster than other codegen
      • massively improved test experience
  • Introduce serialization macro, how to use it / development experience of using it:
    • This section will eventually move to the JSON serialization page
    • Benefits over other serialization options
    • Actual steps with examples:
      • Append annotation, creates ToJson method and FromJson constructor
      • Use any configurations
      • Show the augmentation file/updating (e.g. change field name, comment out annotation) in real time in the IDE
      • Emitting custom diagnostics
    • (maybe) Basic "migration" from json serializable package?
      • remove part, change annotation name, dart run yourProgram instead of running buildrunner, etc...

Future

#5722

Resources

@MaryaBelanger MaryaBelanger self-assigned this Apr 5, 2024
@parlough parlough added d.enhancement Improves docs with specific ask a.language Relates to the Dart language tour meta.evaluation Need to consider what changes if any are needed p1-high Major but not urgent concern: Resolve in months. Update each month. e2-days Can complete in < 5 days of normal, not dedicated, work labels Apr 6, 2024
@pattobrien
Copy link

I've been experimenting with macros for about 4 months now, from a package-author perspective, and have experienced everything from minor feature questions to unrecoverable analyzer crashes that require IDE restarts (to be expected at this stage, of course).

One topic not explicitly stated in the above checklist is what levels of feedback would be welcome and where that feedback should be made, which I think would be helpful for both the Dart team as well as package authors.

@MaryaBelanger
Copy link
Contributor Author

That's a great point @pattobrien, added to the plan (and other plans too, this is a great point for any documentation plan!)

In the mean time, so you don't have to wait for the docs to come out to start filing those issues, feel free to bring up any concern large or small on the language repo (or find an existing issue there to discuss your experience). User feedback from 4 months of experience is incredibly valuable for this feature!

If you specifically want to call out something you want to make sure gets documented, you can leave comments on this issue or open an issue in this repo and link to this issue (#5692) so it gets tracked.

In the actual macros docs I'll probably only point users to the language repo for feedback, but in your case I think you should document your analyzer crash in the sdk repo since that's where the analyzer lives (and it sounds pretty major, I'm sure they'd love to know about it)

MaryaBelanger added a commit that referenced this issue May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a.language Relates to the Dart language tour d.enhancement Improves docs with specific ask e2-days Can complete in < 5 days of normal, not dedicated, work meta.evaluation Need to consider what changes if any are needed p1-high Major but not urgent concern: Resolve in months. Update each month.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants