mirror of
https://github.com/carp-lang/Carp.git
synced 2024-09-11 05:25:28 +03:00
Language.
This commit is contained in:
parent
fb1aecd348
commit
aa03aaefbf
@ -18,7 +18,9 @@ A *borrowing* function is a function that does not take ownership over the value
|
||||
What is a good name for a function that is both owning and internally mutating, like `endo-map`? These functions are common in Carp and allow for a functional programming style without the need to copy or allocate memory.
|
||||
|
||||
### Unsafe function
|
||||
Unsafe functions (most often) start with the prefix `unsafe-` and *can* crash the program if certain preconditions are not met. A good example is `Array.unsafe-first` which gets the first value in an array - calling this if the array is empty this will crash the program. The `unsafe-` prefix is an optional naming convention, there *are* a few functions that are not safe which does not use this naming scheme. A notable example is `Array.nth` which crashes if given an invalid index. Any other unsafe functions should be thoroughly documented as such, and using the `unsafe-` prefix is very much encouraged in library code!
|
||||
Unsafe functions (most often) start with the prefix `unsafe-` and *can* crash the program if certain preconditions are not met. A good example is `Array.unsafe-first` which gets the first value in an array. Calling this if the array is empty this will crash the program.
|
||||
|
||||
The `unsafe-` prefix is an optional naming convention; there *are* a few functions that are not safe which does not use this naming scheme. A notable example is `Array.nth` which crashes if given an invalid index. Any other unsafe functions should be thoroughly documented as such, and using the `unsafe-` prefix is very much encouraged in library code!
|
||||
|
||||
### REPL
|
||||
*REPL* stands for "Read Eval Print Loop" and is a common feature of Lisp system. It allows expressions to be entered and executed at a command prompt. In Carp it is spelled with uppercase letters.
|
||||
|
Loading…
Reference in New Issue
Block a user