aboutsummaryrefslogtreecommitdiff
path: root/README
blob: 473146cd7310d8beaf99f69aebe41a1f7283d347 (plain) (blame)
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
                         Oryx — Programming Made Better

Oryx is named after the oryx animal.  This means that when referring to
Oryx the programming language in languages other than English you should
use the given language’s translation of the animal’s name (e.g. ‘Órix’ in
Portuguese or ‘Όρυξ’ in Greek) as opposed to using the English name.


                         ┌────────────────────────────┐
                         │ Existing Language Features │
                         └────────────────────────────┘

1.  The following datatypes are supported.  The unsized integer types
    default to the systems word size (typically 64 bits).

        i8, i16, i32, i64, i128,  int
        u8, u16, u32, u64, u128, uint

2.  C-style block comments.  Line comments are intentionally not
    included.

3.  Declaration of mutable variables with optional type-inference.  The
    syntax is simple and consistent regardless of if type-inference is
    used or not.  Variables are also zero-initialized unless ‘…’
    (U+2026 HORIZONTAL ELLIPSIS) or ‘...’ is given as a value.

        x: int;       /* Declare a zero-initialized integer */
        x: int = 69;  /* Declare an integer and set it to 69 */
        x:     = 69;  /* Same as above but infer the type */
        x := 69;      /* Recommended style when inferring types */
        x: int = …;   /* Declare an uninitialized integer (preferred) */
        x: int = ...; /* Same as above when Unicode is not possible */

4.  Declaration of constant variables with optional type-inference
    including constants of arbitrary precision.  The syntax is
    intentionally designed to be consistent with mutable variable
    declaration.

    Constants are unordered, meaning that a constant may refer to another
    constant that is declared later in the source file.

        FOO: u8 : BAR
        BAR: u8 : 69;

        REALLY_BIG :: 123'456'789'876'543'210;

        pub MyFunc :: () int {
            return BAR;
        }

5.  Constants of arbitrary precision (overflow is not possible), with ‘'’
    (U+0027 APOSTROPHE) as an optional digit seperator.

        REALLY_BIG :: 123'456'789'876'543'210;

6.  No implicit type conversions between types.  This includes between
    different integer types which may have the same size (i.e. int and
    int64)

        pub MyFunc :: () {
            x: int = 69;
            y: i64 = x;  /* Compile-time error */
        }

7.  Nested functions are supported, but not closures.  Closures will
    never be supported in the language.

        /* Recall that constants (including functions!) can be declared
           in any order.  This lets us define Inner *after* it gets
           called by the assignment to ‘x’. */
        Outer :: () {
            x := Inner(5);

            Inner :: (x: int) int {
                return x;
            }
        }