You’re not skipping B
there either, it’s a shorthand for a where
clause: ::Foo{A,Bi} where Bi
. Julia didn’t used to print shorthands of UnionAll types, so it’s worth checking with typeof
now.
You can do something similar to omit the 1st parameter from the method’s where clause, but it must be made clear there is a type parameter there rather than some other type from the global scope: mymethod(x::Foo{Ai, B} where Ai) where {B}
. Ai
will not be available as a variable in the method body, it’s limited to the parametric type expression.
_
is just a variable, not some placeholder token, and all-underscore variables are intended solely for throwaway assignments, so they can only show up on the left hand side of =
. If you replaced it with a variable Ai
, you’d hit an undefined variable error because Ai
isn’t assigned in the outer scope or specified in a where
clause.