jwovens / plTAP

A TAP emitting framework for Oracle pl/sql
2 stars 1 forks source link

Overloaded "array" object type #6

Closed jwovens closed 8 years ago

jwovens commented 8 years ago

Consider creating an object type within the TAP schema with different constructor methods that, depending on the arguments, a different constructor is invoked returning a nested_table of different intrinsic data types. e.g.

my_array ARRAY := ARRAY('hello','world'); -- creates a nested table of strings my_array ARRAY := ARRAY(1,2,3,4); -- creates a nested table of numbers etc.

Don't know if you can do this, but using an overloaded ARRAY constructor would make testing collections easier.

jwovens commented 8 years ago

The motivation is that the user doesn't need to think in terms of a nested table of strings versus a nested table of integers. This can be achieved in part by subtyping objects, but it is easier to just define a type (nested table of strings) which can also cast numbers as strings. By naming this type as varargs, it has more semantic meaning. e.g can do both of

my_array VARARGS := VARARGS('hello','world'); my_array VARARGS := VARARGS(1,2,3,4);

esc24 commented 8 years ago

Hello