Error when passing closure with any Shape to a function expecting some Shape

Right, like @Jumhyn says, we adopted the explicit use of as any Shape inside the parentheses of a function call as the syntax for telling the compiler "I explicitly don't want to implicitly open the existential." So, the compiler doesn't let you do that because you've essentially asked it not to.

Occasionally, there are other reasons why you want to write as any Shape than to disable implicitly existential opening. And as you show here, you can do so separately before passing the value as a function argument.

5 Likes