Do all types implicitly extend the type Type?

Do all types implicitly extend the type Type (i.e. can all types use methods like prototypeName?)

What is difference between prototypeName method and typeName method?

I don’t think all types (declared with the type keyword) implicitly mix-in Type, because Type has a name field which types don’t seem to inherit.

However, trying to mix-in Type this way:

type MyFavoriteType mixes Type

I can provision, but I get the below error on MyFavoriteType.make({}) (or any other use). Since it’s a stack size exceeded, this leads me to believe that type and Type somewhat refer to a common thing, resulting in an infinite loop.

@chenliu9 prototypeName is like typeName but it removes dynamic bindings (everything after <).

But apparently all types can call prototypeName(). This should show some special connection between all types and Type.

@JohnCoker any thought/suggestion on this one?

Yes, all types mixin Type. Today this isn’t really formalized in the typesystem. Changing this is one of the major focuses of the Orion release when the system will really be “types all the way down”

Is this question just a curiosity or is there some issue you are facing?

Thanks for your response. There is an adjustment in test framework I am trying to make. I want to know if every type has methods like prototypeName and attributes like name as shown in c3ShowType(Type)?

I don’t think this is a correct description. Type is a built-in system type and cannot be mixed in. Declared types are instances of Type. I.e., a declared type is an instance of metadata whose type is Type.


prototypeName returns the name of the unbound type the current type is a binding of. In most cases (for all named types), this will be the same as typeName. However, for dynamically bound types, the typeName includes the binding and the prototypeName does not.

var t = NormTimeseries.bindDynamic(C3.typesys.PrimitiveType.Json);
t.typeName() // NormTimeseries<json>
t.prototypeName() // NormTimeseries


Thanks John. There is a issue in your example,

It should be t.typeName() // NormTimeseries<json>

Ah, formatting. Must use &lt; / &gt;.