Changing the operator actions of JavaScript

 

Permitting the actions of all existing operators to be replaced with user function.

  • existing operators + -  /  *  **  <  <=   >  >=  >> >>> <<  <>  ! =  += -= /= *=
  • replacement for existing operators:
    • process function this + A { ... } replacing the two operator A + B
    • process function this ++ { ... }  the unary post increment
    • process function this = A (name)  { ... }  the assignment operator


The adding of new Operators.

  • adding new operators is to add a different name in one of the following formats
    • process function this any-word:like-op A { ... }  
    • process function this any-word:like-op { ... }
    • process function any-word:like-op this { ... }
       
    • operator function this cross:+ A { ... } (sample precedence and order as the + operator)
    • operator function this times:* A { ... } (sample precedence and order as the * operator)

These operator adjustments can be compiled into the compiler, as a global setting stored and loaded by the compiler at run time , or part of your application.

  • Adding the actions for parentheses () , brackets [], and braces {}, these can be added to any value.
    • operator function this () { ... }   these can be placed on the right or left side of the equal sign =
    • operator function this [] { ... }
    • operator function this {} { ... }