Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove gone deleted keywords and start placing comments for future work #2

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
.venv
*.pyc
/__pycache__
src/.idea
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,23 @@ source .venv\Bin\activate
pip -r requirements.txt
```

`commonmark` is required to compile the documentation. If you're missing it, run:

`pip install commonmark`

You can then run and compile as follows:

```commandline
python compile.py
```

And to see your changes:

```commandline
cd html
python -m http.server
```




2 changes: 0 additions & 2 deletions src/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ ZenCode is a programming language and software which can be used to provide an a

The name "ZenCode" denotes both the language as well as the runtime systems.



What is it?

- A safe system, fully controlled by its host environment. The host application has fine control over which functions the scripts may perform.
Expand Down
182 changes: 0 additions & 182 deletions src/features/storagetags.md

This file was deleted.

3 changes: 3 additions & 0 deletions src/language/additions-v11.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

Enums can be declared as typed enums, eg:

[//]: # (Make example of enums with multiple parameters in the constructor)
[//]: # (The Last line means that `println(Color.Red)` -> 'red')

```
enum UserRole: int {
User, // automatically assigned the value 0
Expand Down
2 changes: 2 additions & 0 deletions src/language/additions-v12.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Tuples and destructuring

[//]: # (WIT: How functional are tuples, what's their utility)

Tuples are immutable mini-structs and can be used as follows:

```
Expand Down
2 changes: 2 additions & 0 deletions src/language/additions-v20.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Destructable values

[//]: # (TODO WIT: Understand how much of this is updated, exists, and is functional / outdated)

Classes can now also have a destructor, which is defined as follows:

```
Expand Down
6 changes: 6 additions & 0 deletions src/language/additions-v30.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# ZenCode 3.0 Extensions

[//]: # (TODO WIT: Difference between Tuple and Class? Immutability and Extensibility I presume?)

[//]: # (Also, has this changed?)

## Structs

It is now possible to define structs, which are passed by value:
Expand Down Expand Up @@ -73,6 +77,8 @@ Sequence(

Borrows can be declared mutable, which makes the val fields modifyable:

[//]: # (TODO Remove this as it will not work on classes, only structs)

```
class MyObject {
val _name: string;
Expand Down
32 changes: 4 additions & 28 deletions src/language/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ For instance, the following wysiwyg strings are valid examples:

Certain identifiers are reserved as keywords. The following keywords are specified:

[//]: # (TODO Remove lock eventually)

```
abstract
alias
Expand All @@ -142,7 +144,6 @@ class
const
continue
default
destructable
do
double
else
Expand All @@ -151,15 +152,13 @@ expand
extern
export
false
final
finally
float
for
function
get
if
in
immutable
implements
implicit
import
Expand All @@ -182,22 +181,19 @@ public
return
sbyte
set
shared
short
static
string
struct
super
switch
this
threadlocked
throw
throws
true
try
uint
ulong
unique
ushort
usize
val
Expand Down Expand Up @@ -897,28 +893,8 @@ for a in [1, 2, 3] {

### Ternary operator

### Combinatorial expressions (&& and ||)

Combinatorial expressions can be used to either:

- Evaluate the right-hand side of an expression if and only if the left-hand side resolves to true or non-null (&&)
- Evaluate the right-hand side of an expression if and only if the left-hand side resolves to false or null (||)

These expressions can be used to combine two conditions, to guard the right-hand side against a certain condition, or as a performance improvement preventing a possible costly expression to be resolved. It can also be used for null handling logic:

```
val x = 5;
if x >= 0 && x < 10 // combine two conditions
println("x is within range");
if x < 0 || x >= 10
println("x is out of range");

function foo(dictionary: int[string]) {
val a = dictionary.get('something'); // type of a is int?
val b = dictionary.get('something') || 0; // use 0 as default value here
val c = a && a + 1; // guard against a being null; if a is null, this expression resolves to null
}
```
[//]: # (TODO Document Coalescence with the test case: https://discord.com/channels/415994300527280159/415994301043048459/1053402061556957194)
[//]: # (See if refactor can compile that)

### Logical and, or and xor

Expand Down