I found in some demo code, both *x
and x*
are used. Sometimes, the star is also used on types, like *int xs
. In the help, only the pattern Var*
is documented. Is there any difference between putting the star before or after a pattern variable?
Good question. The answer is both yes and no:
*
is deprecated, since it triggers syntactical ambiguity with post-fix transitive closure in some weird contexts on the expression side of things. This does not happen in patterns, but for consistency we want to have the prefix *
mean "splat" in patterns and "splice" in expressions, as dual operators, and remove the post-fix *
to avoid confusion.So, please use the prefix +
and prefix *
when possible to avoid upgrade pain in the future when we remove postfix *
and +
from the language.