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
- color - ANSI color codes for console
- console - Console input and output operations
- curses - Terminal-based user interface
- failure - Error handling and exception management
- file - File input and output operations
- http - HTTP handling framework
- math - Mathematical operations and functions
- sdk - Fry's software development kit utilities
- system - System-level operations and information
- time - Time and date manipulation
- zCode - Data encoding, hash and uuid methods
Type Package
This package extends the features of FatScript's native types:
Extra package
These utilities are implemented in vanilla FatScript:
- csv - Rudimentary CSV encoder and decoder
- Duration - Millisecond duration builder
- elapsed - Elapsed time calculator
- HashMap - Quick key-value store
- hex - Hexadecimal encoder and decoder
- json - JSON encoder and decoder
- mathex - Extended mathematical library
- Memo - Generic memoization utility class
- regex - Regular expression common patterns
- Sound - Sound playback interface
- util - Other random utilities
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.
Additionally, importing everything upfront can add unnecessary overhead to your program's startup time, 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.