-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
I have implemented var.(<type>) conversions on my fork.
// vars
a := 1
b := a.(any)
c := b.(num)
d := a.(string) // fails
a:any
a = 1
a = "b"
print (typeof a) // prints underlying type, not `any`. Consistent with current behaviour
// Maps
{a: true b: false}.({}any)
{a: true b: false}.({}any).({}bool)
{a: true b: false}.({}string) // fails
{a: true b: "false"}.({}bool) // fails
// Arrays
print [1 2 3].([]any).([]num).([]any).([]num)
x:[]any
x = [[1 2 3]]
print x
assertEqual "[]any" (typeof x)
x[0] = [7 8 9]
print "x:" x
x[0] = [7 8 9].([]string)
print "x:" x
assert false
[7 8 9].([]string) // fails
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
No status