swiftlang / swift

The Swift Programming Language
https://swift.org
Apache License 2.0
67.64k stars 10.38k forks source link

Switch from GYB to macros/SwiftSyntaxBuilder in the standard library #68575

Open CrazyFanFan opened 1 year ago

CrazyFanFan commented 1 year ago

Since Swift now supports macros, can we consider replacing GYB with macros to achieve the same capabilities? This would make Swift more 'Swift'.

AnthonyLatsis commented 8 months ago

Why have you closed this?

CrazyFanFan commented 8 months ago

Why have you closed this?

My original intention was to tidy up some issues I proposed that have been left undiscussed for a long period. I assumed that the community might not consider these as good ideas.

AnthonyLatsis commented 8 months ago

Could you elaborate on what you meant by replacing GYB with macros? If you were referring to the metaprogrammed standard library Swift sources, then I think we can leave this open as a task, but I imagine we might eventually want to generate those using the swift-syntax SyntaxBuilder library rather than macro-expanding the declarations.

CrazyFanFan commented 8 months ago

Yes, what I want to replace is the GYB in the metaprogrammed Swift standard library sources.
Additionally, using the swift-syntax SyntaxBuilder would be a good idea.

stephentyrone commented 8 months ago

gyb does straight textual substitution, and as such, cannot easily be replaced with macros in general.