Google Summer of Code 2023

Swift participated in Google Summer of Code 2023 with three accepted projects, focused on parsing, type inference and server clients. Here are the accepted projects and the project ideas we offered that year. Browse the other years on the GSoC page.

Discussions from this year are tagged gsoc-2023 on the Swift forums.

Accepted projects

Projects accepted for Swift in Google Summer of Code 2023, as announced on the Swift forums. For an overview of the whole program, read the Swift Summer of Code 2023 summary on the Swift blog.

Key path inference and diagnostic improvements

Contributor: Amritpan Kaur

Mentor: Pavel Yaskevich

Blog: Key Path Inference and Diagnostic Improvements

Results: Key Path inference and diagnostic improvements - An Update

Swift native implementation of a Memcached client using SwiftNIO

Contributor: Delkhaz Ibrahimi

Mentor: Franz Busch

Blog: Swift Memcache

Implement incremental re-parsing in SwiftParser

Contributor: Ziyang Huang

Mentor: Alex Hoppen

Blog: Implement Incremental Re-Parsing in SwiftParser

Results: My GSoC Experience

Project ideas

Swift Dev Experience

Implement Incremental Re-Parsing in SwiftParser

Project size: Medium

Recommended skills

Description

The Swift parser written in C++ was able to incrementally re-parse a syntax tree after an edit, re-using syntax nodes that have not changed. This functionality was not implemented when we re-implemented the parser to Swift.

The goal of this project is to port the old incremental re-parsing design to Swift, set up unit tests that make sure incremental re-parsing produces the same result as parsing the tree from scratch, and to expand the old incremental re-parsing design to re-use more syntax nodes.

Note that the ability to incrementally re-parse a syntax tree has been removed from the C++ code base after SwiftParser was implemented. Check out the release/5.6 branch to view the last version of incremental parsing. This pull request initially implemented incremental parsing in C++.

Expected outcomes/benefits/deliverables

The goal of this project is to implement incremental re-parsing of Swift code in the new parser with a strong focus on performance to keep parsing times well below 10ms, even for files with multiple thousand lines of code

Potential mentors

Swift/C++ Interop

Expand the Swift overlay for the C++ Standard Library

Project size: Medium

Recommended skills

Description

Swift and C++ interoperability is an ongoing open-source initiative that aims to make C++ APIs convenient and safe to use from Swift (and vice versa). An important part of the project is to surface C++ standard library to Swift users through APIs that are natural to use from Swift and at the same time are safe and performant.

The Swift overlay for the C++ standard library is a Swift module that contains Swift extensions for the C++ standard library types. In particular, it provides initializers that allows clients to convert between std types in C++ to corresponding ones in Swift e.g. std::string to Swift.String and vice versa. As part of this project, the participant will identify more APIs where such conversion initializers can be provided and implement them. For instance, an initializer could be added to std::map that takes an instance of Swift.Dictionary as a parameter.

They will also review the API surface of commonly used C++ standard library types and improve their ergonomics when used from Swift.

Expected outcomes/benefits/deliverables

Design and implementation of new C++ standard library overlay functionality that allows converting between more C++ types and Swift types, and expand the C++ std APIs that can be accessed from Swift.

Potential mentors

Swift Package Manager

Scripting in Swift

Project size: Medium

Recommended skills

Description

Swift is a fun and powerful language, and people often want to use it also for their scripting needs. While writing simple scripts in Swift is possible today, it is not possible to use Swift packages in such scripts, which takes away from the full robustness of the language. In this project we will define a user-friendly syntax for expressing package dependencies in a script, a methodology to resolve such dependencies, and integrate the resolution into the Swift command line tools and REPL. Participants will participate in collaborative design, technical writing, and software development.

There’s a pitch which outlines an initial design from a previous GSoC proposal that could be used as the basis of this work. It may need some polish, figuring out the details the project could aim for implementing a basic version of it.

Expected outcomes/benefits/deliverables

The goal of this project is to implement basic support for defining package dependencies for use in a script.

Potential mentors

Customizable package templates

Project size: Medium

Recommended skills

Description

SwiftPM currently supports a handful of hardcoded templates that can act as a starting point for user projects. Since there are many different needs for such templates, there should be a way to customize these templates and share them with others without having to make changes to the SwiftPM codebase itself. It could also be useful to make templates interactive, so e.g. users can pick between including tests by default or choose a set of dependencies to include. In this project, we will define a format for templates, design an API for making them interactive and integrate these into the SwiftPM commandline tool in a user-friendly way.

Expected outcomes/benefits/deliverables

Potential mentors

Swift on Server

Memcached Client

Project size: Medium

Recommended skills

Description

We would like to create a Swift native implementation of a Memcached Client using SwiftNIO for the networking stack. The goal is to implement the meta command protocol of Memcached to send commands and receives responses. To achieve this we need to implement the request encoding and response decoding. Furthermore, our client should support request pipelining to improve its performance.

Expected outcomes/benefits/deliverables

The goal is to support the fundamental commands and expose as an asynchronous-first Swift API.

Potential mentors

Swift-DocC

Swift-DocC Authoring Localization Support

Project Size: Medium

Recommended skills

Expected difficulty: Medium

Description

Swift-DocC-Render recently added support for rendering localized documentation. However, Swift-DocC currently only supports authoring documentation in a single language.

The goal of this project is to design and implement support for writing localized documentation by enhancing the Swift-DocC compiler to support localized DocC catalog inputs and produce an output that’s compatible with Swift-DocC-Render’s existing localization support. The participant will take part in collaborative technical design and Swift-DocC development.

Expected outcomes/benefits/deliverables

Technical design and implementation for authoring localized documentation.

Potential mentors