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
{{ message }}
Repository navigation
I wish it were clearer the "Type Cast Expressions" table is exhaustive #979
I read over the table. Immediately I found myself asking: What happens if you cast to bool? It's not listed.
I tested it, and immediately found that casting to bool is illegal.
Looking at the table after testing it, in retrospect this is "obvious". The reference says: "as can be used to explicitly perform coercions [link to coercion section in reference], as well as the following additional casts". It does not say as can be used for anything else. Therefore, any cast not listed in either the coercion rules or the table must be illegal.
But, I was not able to figure that out just from reading the text! It is too easy to misinterpret "it can be used to do this..." as an example, rather than (as it is apparently intended) a normative definition.
"Expected behavior": What would have helped me is somehow explicitly noting that "coercions, as well as the following additional casts" is exhaustive. So for example putting "(and no others)" after "following additional casts", or putting a sentence after the table saying "Any cast which is not either a defined coercion, or in the above table, is an error".
Activity
mcclure commentedon Mar 17, 2021
Addressed in #982