Next: The isa Operator, Previous: type, Up: Types [Contents][Index]
any
TypePoke supports polymorphism with the any
type. This type is
used in contexts where a value of any type is allowed. For example,
this is how you would declare a function that prints the size of any
given value:
fun print_size = (any value) void: { printf "%v\n", any'size; }
The rules for handling any
values are simple:
any
.
any
.
This means that using any operator that require certain types with
any
values will fail: you have to cast them first. Example:
(poke) fun foo = (any v) int: { return v as int; }
Arrays of any
, any[]
, are also supported: