Libraries
Let's talk about the sweet fillings baked into FatScript: the libraries!
Standard libraries
Essentials
These are the fundamental libraries you would expect to be available in a programming language, providing essential functionality:
- async - Asynchronous workers and tasks
- bridge - Bridge between FatScript and external C libraries
- color - ANSI color codes for console
- console - Console input and output operations
- curses - Terminal-based user interface
- enigma - Cryptography, hash and UUID methods
- failure - Error handling and exception management
- file - File input and output operations
- http - HTTP handling framework
- math - Mathematical operations and functions
- recode - Data conversion between various formats
- sdk - Fry's software development kit utilities
- smtp - SMTP handling framework
- system - System-level operations and information
- time - Time and date manipulation
Type Package
This package extends the features of FatScript's native types:
Extra package
Additional types implemented in vanilla FatScript:
- Date - Calendar and date handling
- Duration - Millisecond duration builder
- Fuzzy - Probabilistic values and fuzzy logic operations
- HashMap - Quick key-value store
- Logger - Logging support
- Memo - Generic memoization utility
- MouseEvent - Mouse event parser
- Option - Encapsulation of optional value
- Param - Parameter presence and type verification
- Sound - Sound playback interface
- Storable - Data store facilities
Import-all shorthand
If you want to make all of them available at once, you can simply do the following, and all that good stuff will be available to your code:
_ <- fat._
While this feature can be convenient when experimenting on the REPL, be aware that it brings in all the library's constants and method names, potentially polluting your global namespace.
fat.std
Alternatively, import the "standard" library, which imports all types (including those from the extra package), as well as named imports from all other packages, like this:
_ <- fat.std
This is equivalent to:
_ <- fat.type._
_ <- fat.extra._
async <- fat.async
bridge <- fat.bridge
color <- fat.color
console <- fat.console
curses <- fat.curses
enigma <- fat.enigma
failure <- fat.failure
http <- fat.http
file <- fat.file
math <- fat.math
recode <- fat.recode
sdk <- fat.sdk
smtp <- fat.smtp
system <- fat.system
time <- fat.time
Note that importing everything in advance can add unnecessary overhead to the startup time of your program, even if you only need to use a few methods.
As a best practice, consider importing only the specific modules you need, with named imports. This way, you can keep your code clean and concise, while minimizing the risk of naming conflicts or performance issues.
Hacking and more
Under the hood, libraries are built using embedded commands. To gain a deeper understanding and explore the inner workings of the interpreter, dive into this more advanced topic.