Interest in re-implementation of PropertyWrappers with Macros

Hello fellow dev's, myself Ansh Gupta .
I am particularly drawn to this project because it aligns perfectly with my skills and interests. Throughout my academic and professional experiences, I have gained proficiency in Swift programming and have a solid understanding of compiler technologies and macro systems. Additionally, I have a strong background in open source development, with experience in languages such as C++, Python, and Java.

I have collaborated on various open-source projects, including contributing to the LLVM project and creating a programming language called Peregrine using LLVM and C++ with a friend. Furthermore, I independently implemented the Monkey Programming language from the book "Writing a Compiler in Go" by Thorsten Ball in C++. These experiences have equipped me with a deep understanding of compiler design and implementation, making me well-suited for this project.

Looking to connect with Pavel Yaskevich who is a potential mentor for this project.So I could get some help on how to start this project and complete it with a success🎉.

1 Like

Paging the mentor @xedin :slight_smile:

Welcome to Swift forums!

Overall it’s best to utilize these forums threads with any questions about details of the idea you might have. Did you already look into the project and have questions about details of getting started etc?

The plan involves creating property wrappers in Swift using macros and init accessors. First, define a macro to generate boilerplate code for the wrapper, considering customization options like initialization logic. Implement an initializer within the wrapper to handle value initialization and validation. Then, handle property access by implementing getters and setters. Utilize macros to generate wrapper code, customize behavior, and demonstrate usage examples. Write unit tests to validate functionality and document wrapper usage with parameters and examples. Integrate the wrapper into existing code and optimize as needed. Gather feedback and iterate on the implementation to refine it. This approach streamlines code, improves maintainability, and enhances readability by reducing boilerplate and providing a consistent interface for property wrapping in Swift.

1 Like

Hello @thisisanshgupta! Welcome and it's great to hear that you are interested! My collegue wrote a great post with some general advice which is applicable to Swift project as well, feel free to reach out to me if you have any specific questions. I think a great proposal would include some examples of existing popular property wrappers like Binding or State and thoughts on what additions/changes (if any) we need to make to macros and init accessor features to enable this.


Thanks, btw is there any draft for proposal which I need to follow?

We have just added some hints to the project ideas page: [GSoC] Add section with tips of how to get started writing a proposal by ahoppen · Pull Request #575 · apple/swift-org-website · GitHub

As for proposals; there is no specific pattern, but here is a good guide: Writing a proposal | Google Summer of Code Guides

Please read all of the "student guide" on the gsoc site, it'll answer a lot of your questions about proposals I think.


Interesting,I think we would need to extend the capabilities of macros and init accessors to handle more complex scenarios, including two-way data binding and managing state changes within a SwiftUI view for binding and state wrappers.