Convenience


To use symbolic names, "enum" is introduced.  enum is also used to label the case.  Some feature is convenient one way or another for particular applications.  Three "forms" are considered.

1. variable number of arguments (tuple)
2. byte array
3. hex number

byte array

var = byte { num num num ... }

var will be a pointer to an array. The size of element in the array depends on the natural size of the system: 16-bit or 32-bit.  This contruct puts constants into consecutive bytes (unsigned) in the data segment.  The starting address is aligned with the word boundary.  The unit of accessing this data is 16-bit for a 16-bit system and 32-bit for a 32-bit system, using the array access syntax.

var[index]

The transparency of this construct to the natural size of the system is both good and bad.  Good because there is only one way to write it.  Bad because the meaning depends on the system.  A programmer has no way to write a portable program (in a sense of being able to run it on both 16-bit and 32-bit systems)

To enable a portable program, there must be a specifier to distinguish the size of the element in the array, perhaps "short" to designate 16-bit element, and "int" to designate 32-bit element.

var = byte { ... }
var = short { ... }
var = int { ... }

but then accessor of data must have a way to discern which kind of data it is accessing (what kind of data the pointer is pointed to?).  Presently, this is beyond the scope of Som language.  Having only "byte" is the minimum requirement to put constants into data segment without major change to the language.  

Another way to make this construct semi-portable is to use the syntax that has the same meaning in both 16-bit and 32-bit system:

var = array { num num ... }

because "array" has natural size (it is 16-bit for 16-bit system and 32-bit to 32-bit system).  Using this method it is possible for a program that is written with 16-bit value constant array to be run on a 32-bit system, it is not true vice versa. 

Hex number

Adding hex number to facilitate low level programming, using

#hex  where hex is 0..9 A..F a..f

in the reference system, only tuple is adopted (no byte, hex).