scenic.core.type_support¶
Support for checking Scenic types.
Summary of Module Members¶
Functions
Can this value be coerced into the given type? |
|
Can values of typeA be coerced into typeB? |
|
Coerce something into the given type. |
|
Coerce something into any of the given types, printing an error if impossible. |
|
Evaluate the func, assuming thingA and thingB have the same type. |
|
Does this evaluate to a member of the given Scenic type? |
|
Convert something to a heading, printing an error if impossible. |
|
Convert something to a scalar, printing an error if impossible. |
|
Convert something to a given type, printing an error if impossible. |
|
Convert something to any of the given types, printing an error if impossible. |
|
Convert something to a vector, printing an error if impossible. |
|
What type this value ultimately evaluates to, if we can tell. |
|
Most specific type unifying the given types. |
Classes
Dummy class used as a target for type coercions to headings. |
|
Checks that a given lazy value has one of a given list of types. |
|
Lazily evaluates a function, after checking that two lazy values have the same type. |
Member Details¶
-
coerceToAny
(thing, types, error)[source]¶ Coerce something into any of the given types, printing an error if impossible.
-
toTypes
(thing, types, typeError='wrong type')[source]¶ Convert something to any of the given types, printing an error if impossible.
-
toType
(thing, ty, typeError='wrong type')[source]¶ Convert something to a given type, printing an error if impossible.
-
toScalar
(thing, typeError='non-scalar in scalar context')[source]¶ Convert something to a scalar, printing an error if impossible.
-
toHeading
(thing, typeError='non-heading in heading context')[source]¶ Convert something to a heading, printing an error if impossible.
-
toVector
(thing, typeError='non-vector in vector context')[source]¶ Convert something to a vector, printing an error if impossible.
-
evaluateRequiringEqualTypes
(func, thingA, thingB, typeError='type mismatch')[source]¶ Evaluate the func, assuming thingA and thingB have the same type.
If func produces a lazy value, it should not have any required properties beyond those of thingA and thingB.
-
class
TypeChecker
(arg, types, error)[source]¶ Bases:
scenic.core.lazy_eval.DelayedArgument
Checks that a given lazy value has one of a given list of types.
-
class
TypeEqualityChecker
(func, checkA, checkB, error)[source]¶ Bases:
scenic.core.lazy_eval.DelayedArgument
Lazily evaluates a function, after checking that two lazy values have the same type.