News for hackers. Stuff that matters.
Re:Python adopts a 12-month release cycle by robomartin on Saturday November 02, 2019 @03:27AM (#21426349)
BTW, you have also hit upon why APL uses distinct symbols.

When your assignment operator is "←" you are never going to confuse assignment for comparison.

    Assignment:

    a ← 23

    Comparison:

    a == 23
Extending this to something like Python:

    # Assignment
    if x ← 3:
        do_something()


    # Comparison
    if x == 3:
        do_something()
In fact, you could argue that once you have a dedicated assignment operator you no longer need the "==" construct, because "=" is enough, which is precisely how it works in APL. The above examples the, would become:

    # Assignment
    if x ← 3: # x is assigned 3 and then evaluated
        do_something()


    # Comparison
    if x = 3: # Is x equal to 3? It even reads exactly as it is meant
        do_something()

So, if we want to reduce error and this kind of ambiguity the solution isn't to now have two different assignment operators using easy to mistype characters but rather to have distinct symbols that cannot be confused. Hence the genius of APL, where the notation is, as Iverson put it, a tool for though and the abomination of J, where notation was tossed out the window in favor of ASCII soup.

The ambiguity could be resolved easily by adopting notation that makes sense. Why do we use "A*B" for multiplication when we can use a proper multiplication symbol "A×B"? Or division? "A÷B" Not to mention the logical comparisons; Or:"A∨B", And: "A∧B" , Nor: "A⍱B", Nand: "A⍲B" (these are real symbols used in Logic, BTW, as well as APL).

There are no comments on this comment yet.