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

Consider fuzzing syntax changes #16448

Open
brianrourkeboll opened this issue Dec 15, 2023 · 0 comments
Open

Consider fuzzing syntax changes #16448

brianrourkeboll opened this issue Dec 15, 2023 · 0 comments

Comments

@brianrourkeboll
Copy link
Contributor

brianrourkeboll commented Dec 15, 2023

Proposal

I wonder whether it might be worth considering setting up some kind of process to fuzz (along the lines of this) any changes to the compiler that could affect either:

  1. The treatment of existing syntax
  2. The treatment of new syntax

I've noticed a pattern of longstanding compiler oddities or inconsistencies as well as of regressions and unintended features accidentally introduced alongside new syntax, both of which might have been caught earlier by fuzzing—that is, generating random programs (FsCheck? Hedgehog?) and asserting whether and how they should compile.

Even some kind of tool that could be run by hand on demand feels like it might be better than nothing.

Problem examples

Here is a quick, non-exhaustive list of examples that fuzzing might have helped catch sooner:

A language like F# is perhaps more prone to this kind of problem than many other programming languages, since most of F#'s features are designed to be composable—the language's expression and pattern-based nature, and the fact that expressions and patterns and types can be nested inside of themselves and each other, means that the language's syntagmatic surface area is already quite vast, and every new or updated construct makes it bigger still.

I think it's inevitable that we humans will fail to consider all of the potential syntactic implications of any given change to the parser or addition of a new syntactic construct.

Some questions

  1. How do other languages handle this kind of problem?
  2. Is it feasible to build and maintain such a tool, or is it known not to be a worthwhile undertaking?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: New
Development

No branches or pull requests

2 participants