Thomas Sandlaà writes: > This gives: > > my @x = (1,2,3); > > my $x = [1,2,3]; > my $x = ref (1,2,3); # also without ()? > my $x = \* (1,2,3); # also without ()? > > Accepting the above completes the junction constructing operators: > > my $x = 1|2|3; # any > my $x = 1^2^3; # one > my $x = 1&2&3; # all > my $x = 1\2\3; # none
That's quite nice, but I've been kind of wanting to go the other way. You know, not every operation in Perl 6 needs to have a punctuation operator. I think we should not use \, and also get rid of ^. I'm interested in seeing an example where using ^ is readable enough over one() where its conciseness is warranted. I haven't found that yet. [1] Luke [1] Arguably you'd want it in type signatues, since this is not very readable: sub foo( one(Dog, Cat, Horse) $x ) But I counter that arguability by saying that you really shouldn't be putting one() in type signatures. If you want something to be an A or a B, and you're not doing any checking later on in the code, then it's fine if it's both A and B. If you are doing checking later on, then it should either be in a multimethod or you should factor it out into an abstract type. Perl's not so keen on what you "should" do, though, but I offer this as solace for those who wish to break the guidelines: sub foo ( one(Dog, Cat, Horse) $x ) :-)