Design‎ > ‎

Expressions

Basics

Most programmers are used to languages like C and Java.  So let's use their
operators, unless there is a reason not to.

String concatenation

String concatenation is used very often.  Let's make it easy to use with an operator.

At the same time, having to convert every type to a string before it can be concatenated
is bothersome.  Automatic conversion is useful, so long as it's not confusing.

1.  Use + for string concatenation:
        "foo" + "bar"
        "number " + 4
       + easy to understand
       -  4 + foo  can be a mathematical plus or string concatenation, depending on the type of "foo".  This can be confusing.

2.  Use .. for string concatenation:
        "foo" .. "bar"
        "number " .. 4
      + no overloading
      - two characters instead of one
      - not obvious what .. does (although it's easy to learn)

The confusion about automatic conversion is more important than the other arguments.
Choice: 2

Boolean operators

1. Use && and || like C
         IF aa && bb || cc
        + common
        - potential confusion with & and | operators

2. Use words: and, or like Python
          IF aa AND bb OR cc
        + easier for non-programmers
        - operators are more difficult to spot, reading back is more difficult

Choice 1: easy to read back is more important




Comments