You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is clearly a type error - last line says it explicitly. tup2 was apparently already initialized (last line says that the original type was tuple<index:int,string>, i.e. something like var tup2 = ( index=5, "str00" ).
By default in Dao once variable has a type, you can't change the type any more. If you wanted to change the type (or part of it), you would need to use explicit runtime (i.e. dynamic) typing for which the word any is reserved - e.g. var x: any = (0, "a"); x = (routine(){}, "b") or better (safer) var x: tuple<any, string> = (0, "a"); x = (routine(){}, "b"). But beware, runtime typing can't be checked in advance (in compile time), so it opens another pandora box of programming mistakes and it's also slower than static typing 😉.
By the way make use of invar instead of var (especially in all interfaces) as it helps to reveal not negligible amount of subtle bugs and has a noticeable positive impact on the programming style 😉 (among other things using read-only or copy-on-write views when interfacing with non-Dao libraries and code allows for significant safety and usually also performance gains).
I just tried this out for fun. Well, this is what comes out.
The text was updated successfully, but these errors were encountered: