cuex/tvar.h: Typed and Type-Representing Variables
[cuex: Expressions]

Data Structures

struct  cuex_tvar

Defines

#define cuex_tvarmeta(qc)   cuex_varmeta_kqi(cuex_varkind_tvar, qc, 0)

Functions

cu_bool_t cuex_is_tvarmeta_q (cuex_meta_t meta, cuex_qcode_t qc)
cu_bool_t cuex_is_tvarmeta (cuex_meta_t meta)
cu_bool_t cuex_is_tvar (cuex_t ex)
cu_bool_t cuex_tvar_is_type (cuex_tvar_t tv)
cuoo_type_t cuex_tvar_to_type (cuex_tvar_t tv)
cuex_tvar_t cuex_tvar_from_type (cuoo_type_t t)
cuex_var_t cuex_tvar_to_var (cuex_tvar_t tv)
cuex_tvar_t cuex_tvar_from_var (cuex_var_t v)
cuex_tvar_t cuex_tvar_new_type (cuex_qcode_t qc, cuoo_type_t type)
cuex_tvar_t cuex_tvar_new_obj (cuex_qcode_t qc, cuoo_type_t type)
cuex_tvar_t cuex_tvar_new_as (cuex_tvar_t v)
cuex_tvar_t cuex_tvar_new_utype (void)
cuex_tvar_t cuex_tvar_new_etype (void)
cuex_tvar_t cuex_tvar_new_uobj (void)
cuex_tvar_t cuex_tvar_new_eobj (void)
cuoo_type_t cuex_tvar_type (cuex_tvar_t tv)
void cuex_tvar_set_type (cuex_tvar_t tv, cuex_t type)
cuoo_type_t cuex_tvar_force_utype (cuex_tvar_t tv)

Detailed Description

A type variable represents an unspecified type which may be part of compound types, and it can itself have a type, which may be another type variable. It is meant for parametric typing and represents equality constraints for type components holding the same variable, as opposed to using a generic type like void *.

It may be desireable to substitute the type variables with the correct type before use, if they are known. Otherwise, type variables are assumed to be the size of a pointer for storage calculations. So, a construct containing type variables can be used directly if bigger objects are stored by reference.


Function Documentation

cu_bool_t cuex_is_tvar ( cuex_t  ex  ) 

True iff ex is a cuex_tvar_t.

cuoo_type_t cuex_tvar_force_utype ( cuex_tvar_t  tv  ) 

Return the type of tv, creating a new universal type variable for it if tv is untyped.

cuex_tvar_t cuex_tvar_from_type ( cuoo_type_t  t  ) 

Unchecked cast from t to a type variable. Use cuex_is_tvar first.

cuex_tvar_t cuex_tvar_from_var ( cuex_var_t  v  ) 

Unchecked cast from v to a type variable. Use cuex_is_tvar first.

cu_bool_t cuex_tvar_is_type ( cuex_tvar_t  tv  ) 

True iff tv represents a type.

cuex_tvar_t cuex_tvar_new_as ( cuex_tvar_t  v  ) 

Create a variable of the same kind, type and quantisation as v.

cuex_tvar_t cuex_tvar_new_eobj ( void   ) 

Create an untyped existential variable.

cuex_tvar_t cuex_tvar_new_etype ( void   ) 

Create an untyped existential type variable.

cuex_tvar_t cuex_tvar_new_obj ( cuex_qcode_t  qc,
cuoo_type_t  type 
)

Create a variable which represents an object of type type.

cuex_tvar_t cuex_tvar_new_type ( cuex_qcode_t  qc,
cuoo_type_t  type 
)

Create a type variable which represents a type of typeclass type.

cuex_tvar_t cuex_tvar_new_uobj ( void   ) 

Create an untyped universal variable.

cuex_tvar_t cuex_tvar_new_utype ( void   ) 

Create an untyped universal type variable.

cuoo_type_t cuex_tvar_to_type ( cuex_tvar_t  tv  ) 

Cast tv to a type.

cuex_var_t cuex_tvar_to_var ( cuex_tvar_t  tv  ) 

Cast tv to a variable.

cuoo_type_t cuex_tvar_type ( cuex_tvar_t  tv  ) 

Return the type of tv or NULL if untyped.

Generated 2009-11-23 for culibs-0.25 using Doxygen. Maintained by Petter Urkedal.