Skip to content

Commit

Permalink
improve operator descriptions and reference listing
Browse files Browse the repository at this point in the history
  • Loading branch information
ellemenno committed Jul 31, 2019
1 parent 6a24d91 commit beaa532
Show file tree
Hide file tree
Showing 11 changed files with 72 additions and 8 deletions.
2 changes: 1 addition & 1 deletion docs/_layouts/reference-list.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ <h1 id="heading" class="ui dividing header">{{ page.title }}</h1>
{% if listable %}
<a class="item" href="{{ site.baseurl }}{{ doc.url }}#/{{ doc.collection | downcase }}/">
<div class="content">
<div class="medium header">{{ doc.title }}</div>
<div class="medium header"><tt>{{ doc.title }}</tt></div>
<div class="description">{{ doc.description | newline_to_br | split: '<br />' | first | rstrip | markdownify | remove: '<p>' | remove: '</p>' }}</div>
</div>
</a>
Expand Down
30 changes: 29 additions & 1 deletion docs/_reference/Operators/op_address.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,35 @@
layout: page
title: '*'
category: operator
search_tags: pointer address
description: get a value by dereferencing a memory address
search_tags: dereference pointer memory star asterisk

footnotes:
-
label: no-references
video: demo_20150121_qa
time: 840
text: references in C++ are just pointers with a different syntax and different defaults, so I would rather have a way to have one thing.
-
label: pointer-declaration
video: demo_20141210
time: 769
text: for pointers, use Pascal-style pointy hat (`^`) instead of ampersand (`&`). still use star (`*`) to dereference a pointer.
-
label: toward-away
video: demo_20141210
time: 821
text: star (`*`) brings us toward the value, and hat (`^`) brings us away from the value.
---

# `{{ page.title }}`

> Use `*` for value, `^` for address[^pointer-declaration] [^toward-away], `!` for ownership <br>
> Jai does not use `&` for references; `using` can provide that functionality [^no-references]
```cpp
{% include code/pointers.jai %}
```
{% include footnotes.liquid references=page.footnotes %}
2 changes: 2 additions & 0 deletions docs/_reference/Operators/op_assign.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
layout: page
title: '='
category: operator
description: assign a value
search_tags: assign assignment equal
---

# `{{ page.title }}`
9 changes: 9 additions & 0 deletions docs/_reference/Operators/op_const.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@
layout: page
title: '::'
category: operator
description: declare a constant (unchanging) value
search_tags: const constant colon
---

# `{{ page.title }}`

Constants in Jai include:

* static values
* enums
* structs
* procedures
2 changes: 2 additions & 0 deletions docs/_reference/Operators/op_note.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
layout: page
title: '@'
category: operator
description: annotate a declaration
search_tags: note at

footnotes:
-
Expand Down
2 changes: 2 additions & 0 deletions docs/_reference/Operators/op_ownership.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
layout: page
title: '!'
category: operator
description: indicate memory ownership
search_tags: memory ownership bang exclamation
---

# `{{ page.title }}`
16 changes: 11 additions & 5 deletions docs/_reference/Operators/op_pointer.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
layout: page
title: '^'
category: operator
description: get a pointer to a value's memory address
search_tags: memory pointer caret hat

footnotes:
-
Expand All @@ -14,19 +16,23 @@ footnotes:
video: demo_20141210
time: 769
text: for pointers, use Pascal-style pointy hat (`^`) instead of ampersand (`&`). still use star (`*`) to dereference a pointer.
-
label: toward-away
video: demo_20141210
time: 821
text: star (`*`) brings us toward the value, and hat (`^`) brings us away from the value.
---

# `{{ page.title }}`

> Use `^` for pointer, `*` for address[^pointer-declaration], `!` for ownership <br>
> Use `^` for address, `*` for value[^pointer-declaration] [^toward-away], `!` for ownership <br>
> Jai does not use `&` for references; `using` can provide that functionality [^no-references]
```cpp
e : Entity;

pointer : ^Entity;
pointer = *e;
{% include code/pointers.jai %}
```
```cpp
owned : node *! = null;
other : node * = *graph.node;
```
Expand Down
9 changes: 9 additions & 0 deletions docs/_reference/Operators/op_return-type.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
layout: page
title: '->'
category: operator
description: define return type(s) for a procedure
search_tags: return type arrow
---

# `{{ page.title }}`
2 changes: 2 additions & 0 deletions docs/_reference/Operators/op_string.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
layout: page
title: '"'
category: operator
description: enclose a string literal
search_tags: string double quote
---

# `{{ page.title }}`
2 changes: 2 additions & 0 deletions docs/_reference/Operators/op_variable.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
layout: page
title: ':'
category: operator
description: declare a variable; can be paired with assignment
search_tags: declaration assignment colon

footnotes:
-
Expand Down
4 changes: 3 additions & 1 deletion docs/_reference/Types/any.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
layout: page
title: Any
category: type
description: a more informative and type-safe version of `void` pointer.\n\nIncludes a type pointer for the type and a void pointer for the value.
description: |-
a more informative and type-safe version of `void` pointer.
Includes a type pointer for the type and a void pointer for the value.
footnotes:
-
Expand Down

0 comments on commit beaa532

Please sign in to comment.