racket

What are .rkt~ files and what purpose do they serve?


This question is about the .rkt~ files that are generated when working with .rkt files using DrRacket. Actually I am not sure if this is specific to DrRacket, but that is the IDE I am using at the moment.

They seem to store the same information as the program with the same name with the .rkt extension, except they are not updated as frequently. I am wondering what purpose they serve, as this would inform how I handle them in version control and whether/when I delete them.

What I have found so far:


Solution

  • The .rkt~ files are what as known as "First Change Files", and .rkt~ is the Unix/MacOS extension for these files. On Windows, the extension is changed to .bak, not .rkt~. They store the state of an existing file before changes were made with DrRacket.

    See the following from the documentation, DrRacket Files

    Separately [from backup files], DrRacket creates “first change” files. When you modify an existing file in DrRacket and save it, DrRacket copies the old version of the file to a special first-change file if no such file exists. The first-change file is saved in the same directory as the original file, and the first-change file’s name is generated from the original file’s name...