two slots, for a view-class' slot-definition type

Sean Champ <[email protected]> Wed, 12 Nov 2003 17:59:10 -0800
Newsgroups gmane.lisp.uncommon-sql
Message-ID <[email protected]>
Hello;

I'm concerned about some .. duality .. regarding the slot that
holds the database 'type' information, for an abritrary view class'
slot definition. 


Some background info, or context:

In UncommonSQL, there's a DB-TYPE slot, on the class
VIEW-CLASS-SLOT-DEFINITION-MIXIN.

The DB-TYPE slot, for that class, as defined in metaclasses.lisp, has
the following documentation: 

    "A string which will be used as the type specifier for this slots
    column definition in the database."



The classes VIEW-CLASS-DIRECT-SLOT-DEFINITION and
VIEW-CLASS-EFFECTIVE-SLOT-DEFINITION, of course, both use that mixin,
along with MOP's related slot-definition classes.

As a result, objects of types VIEW-CLASS-DIRECT-SLOT-DEFINITON and
VIEW-CLASS-EFFECTIVE-SLOT-DEFINITION may have both of :

 -  a DB-TYPE slot,
    readable with usql's VIEW-CLASS-SLOT-DB-TYPE

 -  something else (probably a slot, but who knows), 
    readable with MOP's SLOT-DEFINITION-TYPE 



My first question: Do those two slots need to be seperate and distinct? 

Shouldn't they both 'be' the same slot, or at least their reader methods
return the  same values ? Or, can DB-TYPE be done away with?


Some more questions/proposals:

DB-TYPE = TYPE , for view-class slot-definitions?

If so, the VIEW-CLASS-SLOT-DEFINITION-MIXIN may be modified such that:

1)   SLOT-DEFINITION-TYPE would return the same value as returned by
     VIEW-CLASS-SLOT-DB-TYPE, for a given view-class slot definition. 

2)  the :type initarg, for a view-class slot definition,  would 
    fill the same slot as the :db-type initarg would.

To modify, it as so, should only require the addition of the following
initialization argments, for the DB-TYPE slot in
VIEW-CLASS-SLOT-DEFINITION-MIXIN :  

   :initarg :type
   :reader slot-definition-type

Yet, that may not be necessary.






Perhaps the DB-TYPE slot, on VIEW-CLASS-SLOT-DEFINITION-MIXIN,
should be eliminated?


As a minor point: the :db-type initarg, currently, seems ambiguous; it
may be used on both VIEW-CLASS-SLOT-DEFINITION-MIXIN objects and on
DATABASE objects, and it has different meanings for each.


Also, I see that SLOT-DEFINITION-TYPE is already used in some places
throughout uncommonsql, as if it returned the same value as
VIEW-CLASS-SLOT-DB-TYPE would, already.

After looking at usql's test.lisp then:   Have folks already been
using :type instead of :db-type, for  initailizng the SQL type to be
used for a  view-class' slot  definition? 



Is db-type slot even needed, then, on VIEW-CLASS-SLOT-DEFINITION-MIXIN,
but for compatability with code that may already use it? (code that
could be updated, of course, if that maybe-extra DB-TYPE slot was
elimitated; i'm guessing this wouldn't be a problem, though).



Thanks,


--
Sean Champ
[email protected]