Skip to content

Commit 25f5ef1

Browse files
authored
Merge pull request rust-lang#67 from crlf0710/glossory
[WIP] Add a glossory.
2 parents 2c29398 + 1d949d9 commit 25f5ef1

File tree

2 files changed

+89
-0
lines changed

2 files changed

+89
-0
lines changed

Diff for: src/SUMMARY.md

+2
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,5 @@
5858
[Appendix: Influences](influences.md)
5959

6060
[Appendix: As-yet-undocumented Features](undocumented.md)
61+
62+
[Appendix: Glossory](glossory.md)

Diff for: src/glossory.md

+87
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# Glossary
2+
3+
### Abstract Syntax Tree
4+
5+
An ‘abstract syntax tree’, or ‘AST’, is an intermediate representation of
6+
the structure of the program when the compiler is compiling it.
7+
8+
### Arity
9+
10+
Arity refers to the number of arguments a function or operation takes.
11+
For example, `(2, 3)` and `(4, 6)` have arity 2, and`(8, 2, 6)` has arity 3.
12+
13+
### Array
14+
15+
An array, sometimes also called a fixed-size array or an inline array, is a value
16+
describing a collection of elements, each selected by an index that can be computed
17+
at run time by the program. It occupies a contiguous region of memory.
18+
19+
### Bound
20+
21+
Bounds are constraints on a type or trait. For example, if a bound
22+
is placed on the argument a function takes, types passed to that function
23+
must abide by that constraint.
24+
25+
### Combinator
26+
27+
Combinators are higher-order functions that apply only functions and
28+
earlier defined combinators to provide a result from its arguments.
29+
They can be used to manage control flow in a modular fashion.
30+
31+
### Dispatch
32+
33+
Dispatch is the mechanism to determine which specific version of code is actually
34+
run when it involves polymorphism. Two major forms of dispatch are static dispatch and
35+
dynamic dispatch. While Rust favors static dispatch, it also supports dynamic dispatch
36+
through a mechanism called ‘trait objects’.
37+
38+
### Dynamically Sized Type
39+
40+
A dynamically sized type (DST) is a type without a statically known size or alignment.
41+
42+
### Expression
43+
44+
An expression is a combination of values, constants, variables, operators
45+
and functions that evaluate to a single value, with or without side-effects.
46+
47+
For example, `2 + (3 * 4)` is an expression that returns the value 14.
48+
49+
### Prelude
50+
51+
Prelude, or The Rust Prelude, is a small collection of items - mostly traits - that are
52+
imported into very module of every crate. The traits in the prelude are pervasive.
53+
54+
### Slice
55+
56+
A slice is dynamically-sized view into a contiguous sequence, written as `[T]`.
57+
58+
It is often seen in its borrowed forms, either mutable or shared. The shared
59+
slice type is `&[T]`, while the mutable slice type is `&mut [T]`, where `T` represents
60+
the element type.
61+
62+
### Statement
63+
64+
A statement is the smallest standalone element of a programming language
65+
that commands a computer to perform an action.
66+
67+
### String literal
68+
69+
A string literal is a string stored directly in the final binary, and so will be
70+
valid for the `'static` duration.
71+
72+
Its type is `'static` duration borrowed string slice, `&'static str`.
73+
74+
### String slice
75+
76+
A string slice is the most primitive string type in Rust, written as `str`. It is
77+
often seen in its borrowed forms, either mutable or shared. The shared
78+
string slice type is `&str`, while the mutable string slice type is `&mut str`.
79+
80+
Strings slices are always valid UTF-8.
81+
82+
### Trait
83+
84+
A trait is a language item that is used for describing the functionalities a type must provide.
85+
It allow a type to make certain promises about its behavior.
86+
87+
Generic functions and generic structs can exploit traits to constrain, or bound, the types they accept.

0 commit comments

Comments
 (0)