Hey, Since you wouldn't expect an object to stringify or numify why expect pairs to? I'm not sure i see any value in thatm, $pair.perl.say would be the best way to output one anyway.
my $pair1 = (a => 2); my $pari2 = (b => 3); say $pair1 + $par2; # Error: illegal stringification of pair.? I know nothing, but couldn't users create there own pair class that does what they want? Or extend the builting one to override operators they way they want? Just my 2 cents. On 9/21/05, Juerd <[EMAIL PROTECTED]> wrote: > > Ingo Blechschmidt skribis 2005-09-21 14:47 (+0000): > > my $pair = (a => 42); > > say ~$pair; # "a\t42"? "a\t42\n"? "a 42"? > > say +$pair; # 0 (pairs aren't numbers)? > > # 42? > > # 0 ("a" is not a number)? > > # 0 (~$pair can't be used as a number)? > > say ?$pair; # true (because 42 is true)? > > # true (because pairs are always true)? > > FWIW, I'd opt for ~$pair to be "a\t42", +$pair to be +(~$pair) [1], > > and ?$pair to be always true. > > Pairs are objects, thus references. > > I like your suggestions for ~$pair (though any separator except other \s > characters would do) and ?$pair. > > I don't think +(~$pair) makes any sense, though. It's basically the same > as +(~$pair.key). It's probably wise to avoid that $pair can be confused > for its key or value. A good alternative is hard to find, though. I tend > to prefer 1 at this moment (coincidentally, that's +?$pair). > > > Juerd > -- > http://convolution.nl/maak_juerd_blij.html > http://convolution.nl/make_juerd_happy.html > http://convolution.nl/gajigu_juerd_n.html > -- __________ Eric Hodges