summaryrefslogtreecommitdiff
path: root/docs/naming.txt
blob: 03ab3e4c78eb21ce2d6b59e1ce08250136319542 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
Functions should be named according to one of the following schemes:

	verb_noun
	verb_noun_with_noun

	noun_attribute
	get_noun_attribute -- when the 'noun_attribute' name conflicts with a type
	set_noun_attribute

	noun_from_noun -- convert from one type to another (avoid noun_to_noun)

Prefixes are mandatory for exported functions, macros, enums, globals and types.

	fz for common code
	pdf, xps, etc., for interpreter specific code

Prefixes are optional (but encouraged) for private functions and types.

Avoid using 'get' as this is a meaningless and redundant filler word.

These words are reserved for reference counting schemes:

	new, find, load, open, keep -- return objects that you are responsible for freeing.

	drop -- relinquish ownership of the object passed in.

When searching for an object or value, the name used depends on whether
returning the value is passing ownership:

	lookup -- return a value or borrowed pointer

	find -- return an object that the caller is responsible for freeing