[Chandler-dev] Re: Rough cut of phase 1 EIM API & docs

Phillip J. Eby pje at telecommunity.com
Tue Oct 24 11:07:50 PDT 2006


At 10:45 AM 10/24/2006 -0700, Morgen Sagen wrote:

>On Oct 11, 2006, at 4:37 PM, Phillip J. Eby wrote:
>
>>FYI, I just finished a rough implementation of the phase 1 EIM API
>>(primitive types, aliasing, and conversion).  It's not in SVN yet
>>(so as not to interfere with a4 work), but here is the current
>>doctest, warts and all.  (Most of the warts will be fixed when
>>phase 2 kicks in, adding "Record" and "field" types that will
>>produce better examples.)
>>
>>Review and comments welcomed and requested.
>[...]
>>Creating Subtypes
>>-----------------
>>
>>Sometimes, it's useful to create a field type by copying an
>>existing type.  The ``sharing.subtype()`` function creates a new
>>type from an existing one.  The new type will be of the same
>>primitive type, and it will "inherit" any conversion functions
>>defined for the base type::
>
>Hey Phillip, looks good.  Can you give an example of when we might
>want to create a subtype?

The main reason would be when you want to create a type that is similar to 
an existing type, but differs in size, type URI, or how it handles type 
conversions.  For example, if you had a Text type that was 50 bytes long, 
and wanted to make a new Text type that was 55 bytes that supported the 
same conversions, the idea is that you could do::

     newtype = subtype(oldtype, 'newuri', size=55)

And 'newtype' would now inherit any same type conversions registered for 
'oldtype', but have a different type URI and size.



>Thanks,
>~morgen



More information about the chandler-dev mailing list