mirror of
https://github.com/zaphar/ucg.git
synced 2025-07-21 18:10:42 -04:00
DOCS: Document the syntax for casting.
This commit is contained in:
parent
95293ce87f
commit
9a3bfbad02
@ -213,6 +213,16 @@ The type must be a string literal matching one of:
|
|||||||
("foo" is "str") == true;
|
("foo" is "str") == true;
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Casting
|
||||||
|
-------
|
||||||
|
|
||||||
|
UCG can cast primitive types to other primitive types. UCG is very conservative in
|
||||||
|
the casts it allows however and a failed cast is a compile error. The allowed casts
|
||||||
|
are `int(expr)`, `float(expr)`, `str(expr)`, and `bool(expr)`. Casts are not function
|
||||||
|
calls even though they look like them and as a result you can not define your own
|
||||||
|
functions with the same name as a cast. If the expressions do not resolve to a primitive
|
||||||
|
type that is castable to the desired type then a compile error will occur.
|
||||||
|
|
||||||
Copy Expressions
|
Copy Expressions
|
||||||
----------------
|
----------------
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user