Ella Wilby

F# Compiler - Addition of String Interpolation and Improvement of Type Inference in Various Corner Cases

The community of F# developers are constantly finding areas for improvement. The researcher intends to attempt to implement some of these suggested improvements and then submit a pull request to the GitHub repository for the F# compiler. This will allow for the implementations devised to be reviewed by developers working on the F# compiler and potentially incorporated into the compiler.

The first improvement being the implementation of string interpolation. F# does not currently have any equivalent syntax for string interpolation. Users are therefore limited to the range of C-style *printf functions for string formatting. The *printf functions, however, provide poor readability and so it could be beneficial to have a readable string interpolation syntax in the F# language. The string interpolation implementation will be integrated into the existing printf function and will adhere to it's format specifier syntax.

As such the implementation will allow the user to use string interpolation as follows:

printf "New string interpolation: %(moo)10d. Existing string formatting: %.3f" 42.0

Secondly the researcher intends to improve the type inference of the F# compiler in a few corner cases that have been reported by users to not behave as expected. The number of cases implemented will depend on the difficulty, however, the minimum the researcher aims to achieve is to investigate and implement a stronger and more effective type inference for the following two cases: