4

Is there a programming language or library that lets you customize the shit out of it? Something like C++ templates but with special symbols as custom operators?

Comments
  • 3
    Perl
  • 2
    Brainfuck 🤷‍♂️
  • 3
    Lisp.

    But that might be cheating as there really are no operators as every operator is a function and vice versa.

    Problem with custom operators is precedence.

    https://google.se/amp/s/...

    Adding operators that work well with all other operators is hard to begin with and with custom ones that can be declared you can easily end up with ambiguous syntax or unintended behavior.

    C# has operator overloading, as have some other languages, but this works since the basic precedence does not change.

    So, having build my own scripting language, I can say that except for langs like lisp or langs with a very strict syntax or no precedence except parentheses, you probably do not want to create custom operators.

    But it would introduce some very interesting new bug possibilities :P
  • 1
  • 0
    Thank you for the suggestions!
  • 1
    in Ruby, you can even change the - operators function
  • 0
    @stop this! Perl magic is arcane!
Add Comment