From 8b5e3428a1e569abf763e63e859754e767e107e7 Mon Sep 17 00:00:00 2001 From: Ginger Bill Date: Tue, 14 Feb 2017 16:37:24 +0000 Subject: Optional ok for `union_cast` (similar to map indices) --- code/demo.odin | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'code') diff --git a/code/demo.odin b/code/demo.odin index caee21a05..a2049654c 100644 --- a/code/demo.odin +++ b/code/demo.odin @@ -2,6 +2,12 @@ main :: proc() { + x := type_info(int); + t1, ok := union_cast(^Type_Info.Integer)x; + _, ok = union_cast(^Type_Info.Integer)x; + t2 := union_cast(^Type_Info.Integer)x; + + /* /* Version 0.1.1 @@ -17,7 +23,7 @@ main :: proc() { * Entities prefixes with an underscore do not get exported on imports * Overloaded `free` for pointers, slices, strings, dynamic arrays, and dynamic maps * enum types have an implict `names` field, a []string of all the names in that enum - * immutable variables are "completely immutable" + * immutable variables are "completely immutable" - rules need a full explanation * `slice_to_bytes` - convert any slice to a slice of bytes Removed: -- cgit v1.2.3