Context.js

From Esolang
Jump to navigation Jump to search

Warning

If you love semicolons and lots of typing, you'll hate this language.

If you want to type as little as possible, write code that's clean, understandable, and radically minimal, and to let the computer to figure what you mean, read on.


Example

Which one do YOU find easier to read, type, understand? Be honest.

Javascript

105 chars (each indent counts as one char)

greetByName('Jack')

function greetByName(sName) {
    if (!sName) {
        console.log ('Hi');
        }
    else {
        console.log ('Hello, ' + sName);
        };
    };


contextual, proposed:

36 chars

greetByName'Jack'

greetByName
    ! Say
        'Hello ' sName
        'Hi'

The contextual version has strong typing and locally-scoped variables.

Full explanation


context

This is a proposal for a new programming language, or meta-language, designed for radical brevity plus human-readability. Think CoffeScript or Clojure without all the cruft.

i'm seeking serious developers who are interested in creating a practical, useful language. This is for brave souls who have the courage to completely discard baggage of existing language syntax and practices.

Emphasis on practical. This isn't a joke language, or an academic experiment. It's meant to make js programming simpler and easier for real-world js coders.


A Better Javascript

Why javascript? Because we hate javascript, but it's ubiquitous and we have to use it. We're tired of the timid evolution of javascript. We want to invent a new javascript, written as if we could go back in time and do it right the first time, from scratch.

There's near-zero desire to make it "easy for existing js developers to understand." If someone wants to use this language, they will have to learn it.

Also, near-zero desire to make it "easy for beginner programmers". This isn't an educational language, it's intended for professional work. It's expected that users are already proficient in at least one language, and understand general programming concepts.

We hope contextual.js will inspire other radically-sparse languages.

Context.js is a temporary name for the project; the name may change later to something simpler. Can also be called context.js or contextual.


How it Feels

What's the programmer-experience of programming context.js? It should feel intuitive, light, and quick. Once the language rules are understood, it should be a pleasure to code context.js. Let's stop telling the computer things it should be able to figure out with far fewer characters.

Another Example

JS:

157 characters

var home =
   {
   cit : "Boston"
   };

home.city = function(aCity)
   {
   if (arguments.length)
         this.cit = aCity;
      else
         return this.cit;
   };


CONTEXT:

59 characters

home
    City "Boston"
        .toLowerCase
        'City: ' .

github

https://github.com/contextual-project/contextual.js


Discussion

Various folks discussed this topic here, but most of them missed the point. If your response is "Just use C", then you're missing the point.