[LAU] OT: 2 minute intro to type systems (was C or C++?)

Chris Cannam cannam at all-day-breakfast.com
Fri Oct 15 11:05:20 UTC 2010


On Fri, Oct 15, 2010 at 11:51 AM, Erik de Castro Lopo
<mle+la at mega-nerd.com> wrote:
>> $x = 1;
>> $y = "2";
>> $z = $x + $y;
>
> [...] an implicit conversion from int
> to string is performed on $x and then the '+' operator then concatenates
> the two strings.

Other way around -- the string is converted to an int and the result
is a number.  (This is relatively unfamiliar behaviour, which is why
it came to mind first as showing weaker typing than in other
languages.)  "." is string concatenation in Perl, not "+".


Chris


More information about the Linux-audio-user mailing list