Skip to content

Commit 5dfc1bc

Browse files
committed
std: Add documentation to std/ref
1 parent de763c3 commit 5dfc1bc

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

std/ref/ref.pics

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,39 @@
11

2+
// Module: Ref
3+
// Contains functions for working with references
24
Ref :: module {
5+
6+
// Function: new
7+
// Creates a new reference from a value
8+
//
9+
// Parameters:
10+
// value - The value to create a reference from
11+
//
12+
// Returns:
13+
// A reference value
314
new :: (value) = &value
15+
16+
17+
// Function: deref
18+
// Dereferences a reference value
19+
//
20+
// Parameters:
21+
// ref - A reference value
22+
//
23+
// Returns:
24+
// A value stored in the reference
425
deref :: (ref) = *value
26+
27+
28+
// Function: set
29+
// Updates the value stored in a reference
30+
//
31+
// Parameters:
32+
// ref - A reference value
33+
// value - The value to update with
34+
//
35+
// Returns:
36+
// The updated reference, which is actually the ref parameter
537
set :: (ref, value) = pic_nat_set_ref(ref, value)
638
}
739

0 commit comments

Comments
 (0)