Kewl Programming Language

I recently was recently listening to a talk from the ConFoo Developer Conference and started to have some ideas on what a new programming language could look like. Most of what I have written up here is an example and / or extension of what is discussed in that video. While I don't agree with everything he says about JavaScript, I do find some of his suggestions extremely valuable.

I listed some things that I would like it to do and then I wrote some example code from this as of now not real programming language:

  1. Spaces in identifiers.
  2. Setting a value uses a colon.
  3. Values are constant be default unless the 'var' modifier is used.
  4. Comparing a value uses an equal sign.
  5. Blocks of code are distinguished with curly braces.
  6. Functions are called with the '()' operator.
  7. Functions are first class citizens.
  8. A function can be handled asynchronously by using the -> operator.
  9. Everything is an object and can be defined using a JSON equivalent format.

// The 'Kewl' programming language.

// Comments start with two forward slashes.
// Identifiers can contain spaces.
// Setting a value uses the colon operator.
// Values are constant by default.
my cool value: 4

// Prepending an assignment with 'var' makes it a variable.
var my cool value that can change: 2

// Conditional statements uses a single equals sign.
// If statements do not need parenthesis.
if my cool value = 4 {
  // Functions are called with the '()' operator
  new value: do something cool()
} else {
  // Functions can be passed around just like other values.
  new value: do even cooler stuff(do something cool);

// Curly brackets do not contain scope.

// The return value of a function can be accessed
// asynchronously by stating an identifier after
// the function call and using the '->' operator and curly brackets.
add two values (new value, my cool value) the sum -> {
  print a message (the sum)

// Functions are defined using the 'def' operator.
def do even cooler stuff(function to call) {
  return function to call()

def do something cool (cool value) {
  print a message (cool value)

def do something cool() {
  return 1

def add two values(first value, second value) {
  return first value + second value

def print a message (message) {
  print (message)

Popular Posts