Swapped syntax for Natural numbers and Integers

Migrate your code to support the change in syntax for Natural numbers and Integers

On May 7, 2018 the language standard changed to swap the syntax for Natural numbers and Integers. This section describes what changed and how to migrate your code.

Changes

Before the change, the standard specified that:

  • literal numbers with a leading + were Natural numbers,
  • literal numbers without a leading sign were Integers, and:
  • literal numbers with a leading - were Integers.

In other words:

-- Before

+2 : Natural

 2 : Integer

-2 : Integer

After the change, the standard specifies that:

  • literal numbers without a leading sign are Natural numbers, and:
  • literal numbers with a leading sign (both + and -) are Integers.

In other words:

-- After

 2 : Natural

+2 : Integer

-2 : Integer

Additionally, Natural/show was changed to render Natural numbers without the leading sign and Integer/show was changed to render non-negative Integers with a leading + sign:

-- Before

Natural/show +2 = "+2"

Integer/show  2 =  "2"

Integer/show -2 = "-2"
-- After

Natural/show  2 =  "2"

Integer/show +2 = "+2"

Integer/show -2 = "-2"

Migration

To migrate code you need to:

  • Remove the leading + from all Natural number literals
  • Add a leading + to all non-negative Integer literals
  • Replace Natural/show n with "+${Natural/show n}"
  • Replace Integer/show (Natural/toInteger n) with Natural/show n

Also, you can no longer render Integers without a leading + or - sign