Hacker News new | ask | show | jobs
by X4 4722 days ago
What do you think about not using any operator (but space+"") for concatenation and using a syntax like this:

    var 1   = 5+5 // I would expect: Error 0-9 cannot be used as a variable
    var foo = "Hello " "Bob!" "\nAre you there?"
    var bar = "Hello " 1

    console.info(1) // throw error and refer to var 1

    console.info(foo)
    "Hello Bob!
    Are you there?"

    console.info(bar)
    "Hello 1"
1 comments

Juxtaposition as an operator is already used by function invocation, e.g.

    f "Hello"
If f were a string, how would I know I wanted to concat it instead of calling?
By not making () optional. Honestly I get why people hate curly braces, but parenthesis are important, removing them makes a new language hard to understand, making it optional makes the language (horrible or) simply weird and non-deterministic.

There is ZERO technological or efficiency related benefit in making () optional, it just makes your grammar parser more complex and slows down compile/interpretation time.

If I would have time and no specs given, then I would write a compiler for Sanskrit. It's one of the oldest languages and as accurate as AI Agent languages. Really accurate. Just google for "Sanskrit Artificial Intelligence" and you will find very interesting publications. Here's something by NASA: http://www.vedicsciences.net/articles/sanskrit-nasa.html

Btw. I've written a simple language+vm in C already using bison,flex etc. Our Prof and other students made a custom CPU that runs on a custom OS made for this language called Ninja. A friend of mine extended it by Object Orientation later.