Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the convention for Racket filename extensions?

Tags:

racket

.rkt is the conventional file extension for 'regular' Racket source code. In the documentation, I also see .rktl and .rkts being used. What are .rktl and .rkts used for, and are there any more Racket filename extensions I am not aware of?

like image 306
Flux Avatar asked Oct 22 '18 12:10

Flux


1 Answers

The .rkt file extension is generally used for files that represent modules. These normally have a #lang .... line at the top, or sometimes (module ....). They can be imported as modules with require.

The .rktl and .rkts file extensions are used for files meant to be loaded at the top-level that aren't modules. They don't necessarily have a #lang .... line at the top, and must be loaded in some external environment with load instead of imported with require. These usually have a more "dynamic" feel to them, and they're used more often with scripts that use mutation of variables across multiple files. This is not the "encouraged" style in Racket.

The .rktd file extension is used for files that just have data encoded as s-expressions, not code. These files should not be required or loaded (they should not be executed as code). However, other programs use them to store data on the file system using write, and to read the data later using read. It's purpose is the same as a .sexp file or a .json file, just pure data.

like image 138
Alex Knauth Avatar answered Sep 22 '22 18:09

Alex Knauth