Design & Implementation.

An introduction to Maid.

Maid was designed for beginners, but it was also designed with safety and reliability for those beginners.

Immutable Data

My first major design choice was immutable data. Everything is immutable, you can't modify a string without creating a new one, you can't add values to a list without creating a new one, etc.

obj my_list = [1, 2, 3];
obj my_list = push(my_list, 4);

This guarantees that every time you modify a value, you know when its being recreated and rebuilt. There are no unknown modifications to values, you have control of each value!

Limited Types

Another design choice was limited types; Maid only has three types, number, string, and list. With three types, the language becomes more about self-implementation and simplicity.

  • For example, booleans are just number types 0 and 1:
serve(true); # output: 1
serve(false); # output: 0

The std_hashmap module is just a list with internal key/value pairs

fetch std_hashmap;

obj hm = hashmap();
serve(hm) # output: []

Functions Over Classes

Another design choice was the strong use of functions. Maid doesn't have classes or structs, instead its all function based.

// creates a new broom object
func Broom() {
    give "Broom";
}

obj broom = Broom();

Introducing classes and structs can give newbies headache, instead Maid starts with the basics, functions.

Whole Imports

Another design choice was whole imports. When you import a module with the fetch keyword, it imports everything from that module. No public or private variables, no single choice imports, just import it all.

fetch std_format; // gets everything from std_format module
obj string = format("{}", 123);

Helpful Errors (>=2.0)

Another design choice was helpful error messages. When an error is encountered, Maid tries to help as much as possible. It gives a full overview of what happened, and how users can fix it!

error: something went wrong!

   in: example.maid:0:0
   +
   |
   | broken_code
   | ^^^^^^^^^^^
   |
   + - > help: remove this broken code
process finished with exit code -1

This choice was inspired by Rust' compiler warnings and outputs. The language tries to build you up, not knock you down.