Larry Wall wrote:

>Whatever the answer, it probably has to apply to
>
>    my @a;
>    @a[0] = '1';
>    @a[2] = '3';
>    print exists $a[1];
>
>as well as the explicit delete case.  Are we going to pitch an exception for 
>writing beyond the end of an array?  That seems a bit anti-Perlish.
>  
>

What's the semantic difference between "exists but is undefined" and
"does not exist"?

IOW:

  my @a = (1,2,3);

  @a[1] = undef;

  print exists @a[1];
  print @a[1];

versus:

  my @a = (1,2,3);

  delete @a[1];

  print exists @a[1];
  print @a[1];

If I try to store @a[1], it auto(re)vivifies, right?

If I fetch @a[1], do I get an exception or just an undef?

To force undef, do I use "err" or "//"?

  my $a1 = @a[1] err undef;
  my $a1 = @a[1] // undef;

Does @a.k return different results? (0..2) vs (0,2)

>:     * how do you store nonexistence for native packed arrays
>
>  
>
We've beaten this horse, or one that looks vanishingly like it, a bunch
of times.

1. Implementation issue. Throw it to p6i.
2. For infrequent exceptions, create an exception-list.
3. For frequent exceptions, create a bitmap.
4. For exceptions in unbalanced data, create an escape value.

>: Anyway, I want this behavior to die.  Maybe we should get rid of
>: .delete() on arrays, or maybe we should equate it with
>: .splice($idx,1).
>
>Or maybe we support sparse arrays as one container type.
>  
>
Sure, but what's the default behavior?

If I consume the endpoints of an array, using shift or pop, how is that
different from consuming the middle?

  my @a = (1,2,3);
  shift @a;
  shift @a;

  print @a.indexof(3);   # 0 or 2?

Based on that, I'll argue that the default array mode is "contains a
list," which means that array contents should act like lists. Delete
something in the middle, and you have a shorter list, not a list with a
hole in it.

Harrays and Arrashes can be different types, or maybe can just be
properties of the basic sigillated types.

  my @a = (1,2,3) is arrash;  # sparse
 
  my %h = (1 => 'a', 2 => 'b') is harray;

>I actually used a crowbar last week.  It wasn't pretty, but it got
>the job done.  Well, okay, it got the job started...I still have a
>hole in my living room wall, but my chief interest at the time was
>to make sure my house wasn't going to burn down.  That's about as
>much abstraction as you could wish for in real life.
>  
>
Dude, you're scaring me. Should there be a license required for home
ownership?

=Austin

Reply via email to