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
Type coercion is very useful to signatures. For example, you can coerce a path string into a Path::Class object or a URI string into a URI object. Type coercion in Moose is declared as part of the type, but the user of the type must decide to turn it on.
MooseX::Method::Signatures uses "is coerce" or "does coerce". "does" is an unfortunate choice because its normally used to declare a role. "is coerce" is grammatically awkward. "is coerced" might be better. For compatibility purposes with MXMS it may be best to accept both.
The text was updated successfully, but these errors were encountered:
What I'd actually like to see is a way to do on-the-fly coercion defintions. In the same way that where allows on-demand subtyping without having to declare a subtype, I think that being able to define your coercion right in the signature would be useful.
Syntax would be open for discussion; I was just thinking of using the same from / via keywords that Moose uses for coercion definitions in the types.
Add a signature trait to turn on type coercion.
Type coercion is very useful to signatures. For example, you can coerce a path string into a Path::Class object or a URI string into a URI object. Type coercion in Moose is declared as part of the type, but the user of the type must decide to turn it on.
MooseX::Method::Signatures uses "is coerce" or "does coerce". "does" is an unfortunate choice because its normally used to declare a role. "is coerce" is grammatically awkward. "is coerced" might be better. For compatibility purposes with MXMS it may be best to accept both.
The text was updated successfully, but these errors were encountered: