Hello, I need a variable of type
Class and I found the following behaviors:
I can do this:
puts typeof(Bool | Int32 | Int64 | String) # => (Bool | Int32 | Int64 | String).class
but not this (why?):
c : typeof(Bool | Int32 | Int64 | String) = Bool # => Error: type must be (Bool | Int32 | Int64 | String).class, not Bool.class
also I can do this:
c : Bool.class | Int32.class | Int64.class | String.class = Bool puts typeof(c) # => Class (!!!) puts c # => Bool
Look at this!
typeof(c) is Class (so, union of several Classes is aggregated to the Class and it works)!
but I can’t do this:
c : Class = Bool puts c # => Error: can't use Object as the type of a variable yet, use a more specific type
Class as type directly - but look at example above, when union is aggregated to the
Is this OK?