Glen Turner (vk5tu) wrote,

Phone numbers are not integers

Dear HSC students,

Despite what you may have been told, phone numbers are not integers. Consider the well-known phone number 000. This is not the same as the phone number 0.

Strictly phone numbers are a ordered set, each element of the set being one of ('0', '1', ..., '9').

Depending upon the application the number might be a local number (55501234), a full national number (255501234) or a full international number (61255501234). Moreover phone systems may require 'access codes' to identify the type of number (the good old "dial 9 to get an outside line"), so the dialled number may have not much to do with the phone number. This all means there may be no reliable comparison operator for phone numbers.

Phone numbers are ordered, but numbers which dial with less digits appear earlier appear before numbers which dial with more digits (that is, a breadth-first traversal of an ordered tree).

Complicating the character set there are additional characters in the Touch Tone set: '*', '#', 'A', 'B', 'C', 'D'. There are also two signals in the Plain Old Telephone Service: pause and hook flash, traditionally written as ',' and '!'.

There is also a great deal of syntatic sugar. The most notable being '+' used to represent an international number. When dialling '+' the system substitutes the international access code (such as 0011 in Australia). Other sugar includes '(', ')', '-' and space.

The most expeditious way to represent a number is to use a string. With a reduced character set if you must, but real world programmers know that's just asking for trouble when faced with a real number like "(02) 5550 1234 ask for Jane".

Tags: rant
  • Post a new comment

    Error

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments