class Scalar isa intlike, numlike, ...; # and isa Object or whatever

Qoting A6: "Perl makes a distinction between the type of the variable, and the type of the value"


If we view Scalar as the type of a variable, not value, then we could cease to need all this cleverness with inheritance. People are assuming that

my $a;

is equivalent to

my Scalar $a is Scalar;

I would propose that it, instead, means

my __implicitly_typed__ $a is Scalar;

Furthermore, if you explicitly define a value to be of Scalar type, then this means that it is a container that holds exactly one value -- there should be no expectation that it should behave like an integer, etc. So

my Scalar $a = 1;

should be an error -- you'd have to call the STORE method explicitly to store the value into the scalar value.


Dave. -- http://dave.whipp.name



Reply via email to