Add terminology doc.

This commit is contained in:
Erik Svedäng 2019-06-14 09:20:17 +02:00
parent b320b5df73
commit 344e4820de
2 changed files with 22 additions and 1 deletions

21
docs/terminology.md Normal file
View File

@ -0,0 +1,21 @@
# Terminology (WORK IN PROGRESS)
## Introduction
This document contains commonly used words, concepts and jargon for the Carp programming language. It should be particularly helpful when naming things and writing documentation. Ideally it will remove ambiguity, make us spell things the same way, and generally make the Carp ecosystem feel more unified.
Pull requests for this document are very welcome, and please tell us in the [Gitter Channel](https://gitter.im/eriksvedang/Carp?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) if something is missing!
### Mutating function
What should this mean exactly? Ideally it should only be used for functions ending in a `!` that return `()`. Perhaps it should be called "externally mutating function"..? Or maybe "exo-functions" :)
### Owning function
An *owning* function is a function that takes ownership over the value it is passed. This means that is has responsibility of freeing that memory (or pass it to another owning function, or return it).
### Borrowing function
A *borrowing* function is a function that does not take ownership over the value it is passed. This means that is is not allowed to free the memory of that value but must leave it intact.
### Transforming function / endo-functions
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.
### 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.

View File

@ -330,7 +330,7 @@ eval env xobj =
-- | TODO / BUG: The following code is what I want to write, but it breaks the ability to
-- | 'use' modules and have their functions automatically resolve when calling them from
-- | the repl, like for instance `(use Array) (endo-map ...)`.
-- | the REPL, like for instance `(use Array) (endo-map ...)`.
-- | Having a catch all at the end that routes everything (even errors) to executeFunctionAsMain
-- | Makes it work but that seems strange. Need to investigate this!
-- Right (XObj (Lst (XObj _ _ _ : _)) _ _) ->