forked from ground/ground
Add library guide
This commit is contained in:
21
docs/library-guide.md
Normal file
21
docs/library-guide.md
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
# Guide to Writing Libraries in Ground
|
||||||
|
|
||||||
|
Ground has a "use" keyword which allows you to import libraries written in Ground, executing the code, and importing functions for use. This makes building reproducable bits of code very easy.
|
||||||
|
|
||||||
|
This is a guide of best practices which should be followed.
|
||||||
|
|
||||||
|
## .grnd file extension
|
||||||
|
|
||||||
|
The Ground interpreter will automatically append ".grnd" when you use a library. If you write `use "myLibrary"` Ground will look for "myLibrary.grnd". This is a must-do.
|
||||||
|
|
||||||
|
## camelCase Function and File Names
|
||||||
|
|
||||||
|
For consistency, please use camelCase (with a lower case first letter) when naming functions and file names.
|
||||||
|
|
||||||
|
## Don't use spaces
|
||||||
|
|
||||||
|
It is impossible to use spaces in Ground function names. Please do not use spaces in file names, even though it will work.
|
||||||
|
|
||||||
|
## Use functions for most operations
|
||||||
|
|
||||||
|
Where possible, create functions to do everything needed with your library. You can include some code for initialisation, but don't do the entirety of your operations outside of your functions.
|
Reference in New Issue
Block a user