On Fri, 18 Apr 2003, Jonathan Scott Duff wrote: > On Fri, Apr 18, 2003 at 12:15:18PM -0600, John Williams wrote: > > On Fri, 18 Apr 2003, Paul wrote: > > > What's the point of > > > my Int $i; # ? > > ^ ^ > > | variable/container type > > value type > > > > It's a scalar variable which can only hold Int values. > > So ... $i = "1231" is an error? What about $i ~= "5"? (Where ~= is > the new concat-assign as I understand things) > > These are things that I think shouldn't be errors unless you've asked > for them to be so. And using typed values is necessary, but isn't > sufficient to ask for value type-checking IMHO. Well, the answers to that involve type conversions, and I've been staying out of that part of the conversation. However, I am confident that $i = "abc" is an error. I'm not sure about $i ~= 5, but since ~ is a string operation, I suspicion an error there too. > I've always thought that the "Int" in "my Int $i;" was just a compiler > hint that says "when in doubt, treat this as an Int", but that it would > be perfectly okay to put non-Int things in the $i container or to do > non-Int operations upon it. It's more of an assertion than a hint. ~ John WilliamsThread Previous | Thread Next