Professional Documents
Culture Documents
Mayfair Design
Mayfair Design
Mayfair is a programming language specifically designed to be easy to implement, while being turing complete.
It’s dynamically typed as of now - although it will become statically typed eventually. Here’s how it looks:
// filename: example.mf
// functions need not have a return statement, they return the value of the last expression in the block
fn add_five(x) {
x + 5
}
// if is an expression
var name = if (x > 5) { “Stephen Fry” } else { “Hugh Laurie” };
// but can also be used as a statement
if (10 > 3) {
print(“math works”)
else {
print(“idk”)
}
// Mayfair has first-class functions, so you can assign function literals to variables
var mul = fn(x, y) { x - y };
// booleans
var is_legacy = true;
Mayfair is a WIP - the language will become much better and more useful as we progress along this project. for loops, struct , iterator , static or atleast
gradual typing etc. are not very hard to implement, but they won't be the focus until this entire specification has been implemented.