Darren Duncan schreef: > A variable whose value is undefined is still a typed container; eg: > > my Int $z; # undef since not assigned to > my Str $y; # undef since not assigned to
If 'undef' becomes 'fail' at the same time that those base types don't have default start-values such as 0 and '' (and the start-status defined), then most coders will find a way to make Int-s start as defined and 0 and Str-s as defined and '', and put the line that does that in the start of every snippet that they create. Which would bring us back to nothing. So if 'undef' becomes 'fail', also give base types the start-status 'defined' and a normal start-value like 0 and +0.0 and '' and false. It should be made easy though to minimize what the constructors of the base types do, for clean coders (use fatal). So I almost agree with what Luke said: 'make undefs and exceptions the same thing, and to do away with "use fatal"', but see "use fatal" as the switch to disable (or minimize) the base type constructors. > For all practical purposes, an undef is unuseable random garbage I don't agree. 'undef' is a status. Status is orthogonal to value. > The odds of two undefined values in such primitive data types being > equal is 1/Inf, which is zero. Why gamble? -- Grtz, Ruud