Daniel Ruoso wrote:
> I've just realized we were missing some spots, so remaking the list of
> possibilities
>
>  my $a = sub s1 { return a => 1 }
>  my $b = sub s2 { return a => 1, b => 2 }
>  my $c = sub s3 { return 1, 2, 3, a => 1, b => 2 }
>  my $d = sub s4 { return 1 }
>  my $e = sub s5 { return 1, 2, 3 }
>  my $f = sub s6 { return 1: #< it doesnt matter > }
>  my $g = sub s7 { return }
>
> But while writing this email, I've realized that a Capture object is
> supposed to implement both .[] and .{}, so maybe we can just simplify...

Bear in mind that some list objects can use .{} (for customized
indices) as well as .[] (for standard indices).  As such, $e ought to
get a List rather than a Capture.  And if you're going to go that far,
you might as well go the one extra step and say that $b gets a Hash
rather than a Capture.

But I agree about $a, $c, $d, $f, and $g.

>  $g is an undefined Object
>  $f is 1
>  $d is 1
>  $a is a Pair
>  everything else is the Capture itself

Of course, that's only a third of the problem.  What should people
expect with each of these:

  my @a = sub s1 { return a => 1 }
  my @b = sub s2 { return a => 1, b => 2 }
  my @c = sub s3 { return 1, 2, 3, a => 1, b => 2 }
  my @d = sub s4 { return 1 }
  my @e = sub s5 { return 1, 2, 3 }
  my @f = sub s6 { return 1: }
  my @g = sub s7 { return }

  my %a = sub s1 { return a => 1 }
  my %b = sub s2 { return a => 1, b => 2 }
  my %c = sub s3 { return 'a', 1, 'b', 2, a => 1, b => 2 }
  my %d = sub s4 { return 1 }
  my %e = sub s5 { return 'a', 1, 'b', 2 }
  my %f = sub s6 { return 1: }
  my %g = sub s7 { return }

Should @a == (), or should @a == ( a => 1 )?  Or maybe even @a == ( 'a', 1 )?
Likewise with @b and @f.

Should %e == {} or { a => 1, b => 2 }?

-- 
Jonathan "Dataweaver" Lang

Reply via email to