in reply to Re: Static typing is mostly a waste of time
in thread Static typing is mostly a waste of time

Neither does @foo get converted to a scalar, nor is + defined differently for @foo than it is for $bar.

The value of @foo is a number in scalar context, but it's not a conversion - @foo doesn't change. Nor is + internally a huge dispatch table, doing all kinds of different things depending on the types of its arguments. Binary + always gets two scalars as arguments, and isn't doing anything before the scalar values are known.

  • Comment on Re^2: Static typing is mostly a waste of time

Replies are listed 'Best First'.
Re^3: Static typing is mostly a waste of time
by dragonchild (Archbishop) on Apr 12, 2005 at 14:39 UTC
    I said: + is defined differently for @foo than it is for $bar. It's not conversion - it's polymorphism.

    How that polymorphism is achieved is irrelevant. '+' will do the right thing when handed varying types. The fact that '+' imposes scalar context upon its operands and @foo in scalar context is "$#foo + 1" doesn't change the fact that it's '+' which is the agent of the context conversion.

      You're absolutely right. If you define polymorphism to be that, then indeed, it's polymorphism.