<@U3T6LDWTD> I like it all but I think the use of ...
# language-proposals
r
@benleggiero I like it all but I think the use of
as
is missleading since it's already associated with casting. I think what you have here is an explicit type ascription and
:
would be more appropiate since that is already used for type ascription in functions, local variables etc. It's also how it's represented in other languages: https://stackoverflow.com/questions/36389974/what-is-type-ascription https://stackoverflow.com/questions/2087250/what-is-the-purpose-of-type-ascriptions-in-scala
Copy code
takesAmbiguousType([1, 2, 3] : Set<Int>) // OK
takesAmbiguousType([1, 2, 3] : Array<Int>) // OK
👍 3
b
Wait… I might’ve been operating under a false assumption. I hate when this happens… for some reason I thought this was fine
Copy code
var x = 7 as Short
I was under the impression that was type hinting, but I was probably thinking in Swift mode. I should’ve actually tried it and seen the “can never succeed” compiler warning. Ascription sounds like an interesting thing. Also sounds like a separate proposal which might block this one?