To me, the syntax of a language has to be at least three things:

  1. Beautiful.
  2. Convenient.
  3. Safe.

The first point, that the language is beautiful, I expect to accomplish with little or no effort as I have the Occam and Python languages to be inspired by.

The second point, that the language is convenient to use, I expect to accomplish through the Python inheritance.

The third point, that the language is safe to use, also involves the semantics of the language. For instance, the original K&R C is unsafe both syntactically and semantically, modern variants of C are mostly unsafe semantically even though the syntax leaves a lot to be desired in my mind. One of the ways I intend to make Braceless a syntactically safe language is by applying these rules rigorously:

  1. No keyword may be abbreviated ever. So, the user has to accept to type enumeration instead of enum whenever he or she defines an enumeration.
  2. Hard-to-read constructs, like nested C-style conditional operators (x ? y : z), will be spelled out plainly like this: if x then y else z and nesting of them will be prohibited.
  3. Very complex mathematical expression can take ages to decode for which reason Braceless simply limits how complex expressions you can make.

Other than that, I can already now reveal that the syntax of Braceless is very straightforward. It is sort of like C# syntax changed into a Python-style syntax.

The code below is just a rough sample; it does not compile with the current version of the Braceless0 compiler, but it does show where I am headed:

Please notice that the code sort of assumes that overloading is in place even though I've deferred support for it until a later time.

module String:

    class String:
        # NOTE: Value declarations (member variables) are always protected and field declarations (accessors) are always public.

        # Buffer attribute, no public access.
        value buffer is pointer to character

        # Length attribute, full public read-write access.
        value length is cardinal
        field Length is io length:
                if $value > .length:
                    throw new StringError(this, "Cannot extend the length field")
                let .length = $value

        # Extent property, read-only access.
        value extent is cardinal
        field Extent is out extent

        # Factor property, full read-write access.
        value factor is cardinal
        field Factor is io factor:
                if $value == 0 or $value % 8 <> 0:
                    throw new StringError(this, "The growth factor must be a multiple of eight")
                let .factor := $value

            let .buffer := none
            let .length := 0
            let .extent := 0
            let .factor := 32

            release .buffer

        operator :=(that is String):
            # Resize the recipient string, if too small.
            if that.length > this.extent:

            # Copy the source string to the recipient string.
            let this.buffer[:that.length] := that.buffer[:that.length]

            # Assign the length and we're done.
            let this.length = that.length