//variable declarations int anInt = 42 //anInt is now irrevocably an integer and assigning another type to it is an error vartype aVariable = 42 //aVariable is currently an integer, but any type can be assigned to it in the future //function definitions int countElements(Collection c) {return c.count();} //c HAS to be a collection, since countElements doesn't make sense otherwise void addToCollection(CollectionCollection& c, vartype v) {c.append(v)} //c is passed by reference here
int main(String[]string<> args=null){printf("hello, world"); return 0;} //this code also demonstrates anothertwo featureother features, default arguments for functions (not explained further) and immutable lists like string<> (see 6. Built-in datatypes)
**5. Namespaces **5. Namespaces
- An
int datatype or types. If there is only one int type, it should have unlimited range. If there are more, there should be implicit upcasting into the smallest type capable of holding the result of a computation, with the unlimited range type being the largest. - A single built-in
float type, which is equivalent to an IEEE 754 double - A mutable
list type which is implemented as either a doubly linked list or a block of contiguous memory holding pointers to each element - An immutable
list type that acts like an array but whose size cannot be changed after creation - Mutable and immutable
string types, with the default being immutable. - A
map or dict type that is mutable, and holds immutable keys and mutable and/or immutable values. - The built-in collection types should be homogeneous typed by default, but can be
vartyped if required - A
boolean type - A
null or none type that can be assigned to a variable of any type.
7. Call by value and by reference
You should be able to call functions by both value and reference, with the default being value (i.e., a copy of the argument is made and operated upon in the function).
8. Pointers
The language should have pointers and allow pointer arithmetic. Pointers can only be statically typed (to avoid the nightmare that is a void*). vartype pointers are explicitly disallowed. Having pointers and pointer arithmetic allows the language to be seriously used as a systems programming language.
9. Inline assembly
In connection with 8., The language should allow inline assembly language code for those situations where it is necessary.
10. Safety
The language should be mostly safe to use, supporting exception handling etc. Pointer arithmetic and inline assembly can be relegated to portions of the code explicitly marked as unsafe. Unsafe code is allowed, but strongly discouraged.
11. Undefined behaviour
The language standard should specify how the program is to behave under all circumstances except in code explicitly marked unsafe, i.e., there should be no undefined behaviour outside of unsafe blocks. This allows the language to be used as a viable application development language, while still allowing you to say, write an OS in it.