.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?
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
. Its purpose is the same as a .sexp
file or a .json
file, just pure data.
.rktl
used for load-scripts, but I've actually never seen .rkts
used in actual code before. –
Heuer .rkts
files in the racket source directory. So it wouldn't surprise me if its an old extension, or if someone else uses it to generate Racket code, or if you are thinking of something like rktc
, which is racket pre-processed c code. –
Dichy .rkts
is used in the documentation. –
Gravitative © 2022 - 2024 — McMap. All rights reserved.
.rktl
and.rkts
are interchangeable? – Gravitative