﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	severity	resolution	keywords	cc
691	"Add an ""arrayType"" member to psArray"	rhl@…	Paul Price	"We make very extensive use of psArrays in the PS processing, but there's no way
for a routine to check that it's getting the right type of array.  By using psArrays
we've given up on the option of compile-time checking, but we can include
a type in the psArray struct that at least allows a routine to assert that it's being
passed the right type.  This has two virtues:
   1/ It checks the types
   2/ It allows the reader of the code to know what type's expected.  You could
use a comment for this, but comments tend to get out of date.

I propose that we add a field ""arrayType"" to the psArray struct.  This would be a
(void *) pointer, that could point to a (persistent) member of the type that should
be stored on the array.  We should probably initialise this to NULL, but we could
add a new argument to psArrayAlloc.

Why would this help?  Because (with the additions to the object APIs discussed
in PRs 689/690) the psArrayAdd code could check that the added element was of
the desired type:
       if (!psTypeEqual(newElement, array->arrayType) { ... }
and a consumer of psArrays could say:
      assert (pmIsSource(array->arrayType));

The new element isn't strictly neccessary for this last use, but the test would have
to special-case empty lists, and it would be unable to check their types."	enhancement	assigned	low		PSLib	unspecified	minor			
