On Sat, 26 Oct 2002, Damian Conway wrote:
: I suspect disjunctive superpositions will get a great deal
: of use as sets, and so the ability to add an element to an
: existing set:
:
: $set |= $new_element;
:
: might be appreciated. But it's no big thing.
Or maybe it is a big thing. People keep asking why they can't say
$a[1][2] = 2;
$a[1]{a} = "A"; # type error?
Well, maybe they can now:
$union = [1,2,4,8];
$union |= {a => "A", b => "B", c => "C"};
$union[2] # 4
$union{a} # "A"
It's not just a union, of course. You can go on to say:
$union |= {a => "ant", b => "bug", c => "catepilllar"};
$union{a} # "A" | "ant"
That's all assuming that [] and {} (and (), for that matter) actually
select only appropriate refs from the superposition of refs.
Larry