-
-
Notifications
You must be signed in to change notification settings - Fork 9
Intrinsic Procedure __as__
IsaacShelton edited this page Mar 21, 2022
·
1 revision
The __as__
function is used to create user defined conversions between types
There are two primary ways of declaring __as__
.
When using a regular definition, the conversion will require explicit use of cast
or as
to take effect.
func __as__(from FromType) ToType {
}
result ToType = from as ToType
When the implicit
keyword is thrown out in front, then the conversion will not require cast
or as
to take effect. It will perform conversions between types even when the cast is never explicitly invoked.
implicit func __as__(from FromType) ToType {
}
result ToType = from
See user defined conversions for more information