Hi,

I have implemented DataTable and a decent DSL to make SQL like queries on it 
(where, select, order, group_by is supported). Table is represented as 
tuple/object of columns, each column is seq of some type, usually primitive 
type. 
    
    
    type
      DataTable = concept x
        x is tuple|object
        for f in fields(x):
          x is seq   ## all columns should be of the same length
    

The definition is clear and simple, I am pretty happy with it. The names of 
columns and types of columns are known at compile time, scheme is set in stone 
at compile time.

Now, I want to define _ordered_ DataTable by one of the columns (think of Table 
with set primary key). OrderedDataTable is a DataTable, this is the 
relationship I want to maintain so all procs accepting DataTable should work on 
OrderedDataTable as well. The key is simply the name of the column the table is 
sorted on and it is known at _compile time_. Since key is known at compile 
time, I though I can have it as _type tag_ only and keep binary representation 
untouched.

Basically, I was leaning towards something like this
    
    
    type
      OrderedDataTable[key: static[string]] = concept of DataTable
        # Not clear what to do with key to preserve it
    

OrderedDataTable is "type tagged" tuple, its binary representation **exactly** 
the same as of untagged tuple, but type info contains extra string tag that I 
can extract using getTypeInst() in macro or any other means.

Does it sound possible or reasonable?

Reply via email to