Search code examples
operatorsprogramming-languages

Example of programming language that is left associative?


I was teaching a friend about programming and I had a hard time convincing them that a = b and b = a are two very different things.

I eventually found the correct words to describe it (right associative) which got me thinking.

Are there any programming languages which are left associative? I have never seen a language where:

a = b results in b being set to the value of a.


Solution

  • If we talk about Operator associativity we should actually consider two types of associativity: side_associative (e.g. = ) or non-associative (e.g. == ) as it doesn't make any difference for a machine if it get's the line from left to right or from right to left.

    There are no such programming languages that are originally left associative but some of them allow it via operator overloading and some (e.g. R) will allow both: -> and <-.

    I believe no-one will like it in Europe but it might be found lovely in the Middle East. I can imagine that there are IDEs that switch right-side with left-side but at the end compilers are written in an European way.