#460 Removing Dynamic Type Feature

brian Fri 13 Feb 2009

I think I am going to disable the dynamic type feature. I thought I would end up using this feature for Bespin, but I ended up compiling code on the fly instead. So I am not sure this is the right road to go down and since I am not pounding on this feature, I think the safest thing is to take it out for now.

The only public API using this feature is SQL which will require some minor changes.

When you have a Row you will use cols instead of type:

row.type.fields  =>  row.cols

Given a Row[] things are little tricky. One of the cool things about using types is that you can get the column meta-data from the list type even without any rows:

Row[] rows := ...
rows.of.field("id")  =>  Col { name = "id" }

In order to make that work without subclassing Type, I will need to change the Statement API a bit:

// current version
Row[] query([Obj:Obj]? params)

// new version
ResultSet query([Obj:Obj]? params)

class ResultSet
{
  Col[] cols
  Row[] rows
}

So the only change to your code would be to append .rows:

// old code
rows := service.sql("select * from Foo").query

// new code
rows := service.sql("select * from Foo").query.rows

I will probably also remove queryEach in favor of:

// old code
rows := service.sql("select * from Foo").queryEach |Row r| { ...}

// new code
rows := service.sql("select * from Foo").query.each |Row r| { ...}

Login or Signup to reply.