{DESIGNER ALERT - Allison, what think?} On Thu, Aug 17, 2006 at 12:31:11PM -0700, Patrick R. Michaud via RT wrote: > I rely on the "return empty string" behavior. In particular, changing it > to return NULL will mean in many places that I will have to replace > single-line key lookups > > $S0 = hsh['key'] > > with > > $S0 = hsh['key'] > unless null $S0 goto label > $S0 = '' > label:
Indeed. I think we can reduce the pain of dealing with this to the point where you'll hardly feel it. For example, I really like Python's lookup semantic where you can provide the default value on the call. How about a 'default' opcode that provides a value instead of null? It would work for strings and PMCs. Something like: $S0 = default hsh['key'], '' or $P0 = new .Undef ... $P1 = default hsh['key1'], $P0 $P1 = default hsh['key2'], $P0 ... It would work without the lookups too: $S0 = default $S0, '' # if $S0 is null, assign it '' what say? -- Chip Salzenberg <[EMAIL PROTECTED]>