Implicit type conversion: Difference between revisions

m
Fix Perl 6 -> Raku in comments
(Rename Perl 6 -> Raku, alphabetize, minor clean-up)
m (Fix Perl 6 -> Raku in comments)
Line 1,071:
=={{header|Raku}}==
(formerly Perl 6)
Perl 6 was designed with a specific goal of maximizing the principle of DWIM (Do What I Mean) while simultaneously minimizing the principle of DDWIDM (Don't Do What I Don't Mean). Implicit type conversion is a natural and basic feature.
 
Perl 6Raku was designed with a specific goal of maximizing the principle of DWIM (Do What I Mean) while simultaneously minimizing the principle of DDWIDM (Don't Do What I Don't Mean). Implicit type conversion is a natural and basic feature.
Variable names in Perl 6 are prepended with a sigil.
 
Variable names in Perl 6Raku are prepended with a sigil.
The most basic variable container type is a scalar, with the sigil dollar sign: $x.
A single scalar variable in list context will be converted to a list of one element regardless of the variables structure.
Line 1,135 ⟶ 1,136:
 
User defined types will support implicit casting if the object has Bridge method that tells it how to do so, or if the operators in question supply multiple dispatch variants that allow for coercions.
Note that Perl 6Raku does not support implicit assignment coercion to typed variables.
However, different-sized storage types (int16, int32, int64, for example) are not considered different types, and such assignment merely enforces a constraint that will throw an exception if the size is exceeded. (The calculations on the right side of the assignment are done in an arbitrarily large type such as Int.)
 
10,333

edits