Functional, Verbose, Sensical: A Programming Language Proposal

A while back I wrote up some quick thoughts on what a programming language would look like if it's identifiers could contain spaces. In my example program I also had the colon used for setting spaces and the single equals sign used for comparisons. The other day I had some ideas for a purely functional version of some of these same concepts.

Here are the features of the as of yet non existent programming language:
  1. The only objects are modules, globals, functions and parameters.
  2. No variables. This is a purely functional language.
  3. Every global and parameter is a stream and so can have 0, 1, or more values.
  4. Modules define, import, and export globals and functions.
  5. Each module can have a single entry function which is the function that is run when the module is run.
  6. Identifiers can contain spaces
  7. Setting globals and parameter defaults uses a colon
  8. Conditional equality expressions uses a single '='.
  9. If statements are streamlined as shown below for easy conditional handling.
  10. Each function can only contain a single expression making this language purely functional
  11. Error handling is done using the if statement.
  12. You can use values that might not exist and then handle the error cases further down the if statement.
Below is what a programming language with these features might look like. I have highlighted reserved words in orange, identifiers in blue, and literal values in green.

module age groups {
  import print from command line output;
  import error from command line output;

  max baby age: 2;
  max kid age: 12;
  max teenager age: 17;

  function tell the user they are a baby {
    print('You are a baby')
  }

  function tell the user that they are a kid {
    print('You are a kid')
  }

  function tell the user that they are a teenager {
    print('You are a teenager')
  }

  function tell the user that they are an adult {
    print('You are an adult')
  }

  export function tell the user what age group they are in (age{
    ? age <= max baby age :
      tell the user they are a baby
    ? age < max kid age :
      tell the user that they are a kid
    ? age < max teenager age :
      tell the user that they are a teenager
    ? has one value(age) :
      tell the user that they are an adult
    ? has multiple values(age) :
      error('Please provide only one age')
    ? no values(age) :
      error('No age was provided')
    : // this would be the else case, but based upon the above statements it should never be reached.
  }
}

module my program {
  import tell the user what age group they are in from age groups;
  import the users age from command line arguments;

  entry function run the program {
    tell the user what age group they are in(the users age)
  }
}

Comments

  1. wonderful article contains lot of valuable information. Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article.
    This article resolved my all queries.good luck an best wishes to the team members.continue posting.learn digital marketing use these following link
    Digital Marketing Course in Chennai

    ReplyDelete
  2. With special privileges and services, UEFA BET offers opportunities for small capitalists. Together ufa with the best websites that collect the most games With a minimum deposit starting from just 100 baht, you are ready to enjoy the fun with a complete range of betting that is available within the website

    ufabet , our one another option We are a direct website, not through an agent, where customers can have great confidence without deception The best of online betting sites is that our Ufa will give you the best price

    หาคุณกำลังหาเกมส์ออนไลน์ที่สามารถสร้างรายได้ให้กับคุณ เรามีเกมส์แนะนำ เกมยิงปลา รูปแบบใหม่เล่นง่ายบนมือถือ คาสิโนออนไลน์ บนคอม เล่นได้ทุกอุปกรณ์รองรับทุกเครื่องมือ มีให้เลือกเล่นหลายเกมส์ เล่นได้ทั่วโลกเพราะนี้คือเกมส์ออนไลน์แบบใหม่ เกมยิงปลา

    อีกทั้งเรายังให้บริการ เกมสล็อต ยิงปลา แทงบอลออนไลน์ รองรับทุกการใช้งานในอุปกรณ์ต่าง ๆ HTML5 คอมพิวเตอร์ แท็บเล็ต สมาทโฟน คาสิโนออนไลน์ และมือถือทุกรุ่น เล่นได้ตลอด 24ชม. ไม่ต้อง Downloads เกมส์ให้ยุ่งยาก ด้วยระบบที่เสถียรที่สุดในประเทศไทย

    ReplyDelete
  3. Amazing Article ! I would like to thank you for the efforts you had made for writing this awesome article. This article inspired me to read more. keep it up.
    AWS certification course in Chennai

    ReplyDelete
  4. Probably the most genuine football betting UFABET that's over and above description Find fun, excitement and excitement with slot video games, hundred no cost acknowledgement, fast withdrawal. In case you would like to relax slots for cash No need to deposit a lot, without minimum, without need to talk about, squander time simply because UFABET is really reduced, paid heavily, a number of good promotions are waiting for you. Ready to assure enjoyable, no matter if it is Joker SlotXo fruit slot, we can telephone call it an internet slot internet site for you especially. Able to relax Like the support team which is going to facilitate slot formulas as well as strategies of actively playing So you can be sure that every moment of fun and pleasure We'll be there for you to provide the customers of yours the best appearance and also total satisfaction.
    บาคาร่า
    สล็อต
    ufa
    แทงบอล

    ReplyDelete
  5. Hiring a professional residential security in bodyguard company
    London is practical, especially for residential properties that are spread over a large property.

    ReplyDelete

Post a Comment

Popular Posts