look, I don't mean to go on a rant here, but...

<DennisMiller>

I want to create a tied array to simplify 
using bit vectors.

The array would have the behaviour such that
in scalar context of the array, I would access 
a stored integer value. when indexing into the
array, I would access an individual bit into
that integer, converting the integer to a binary
number, and the index would be the bit index
into the number.

I got it to work, sort of.

the code that uses this tied array looks like this:

######################
SmartArray::new(my @arr);

$#arr=8;  # 1000 binary

$arr[1]=1; # 1010 binary

print "arr is "[EMAIL PROTECTED]"\n"; # arr is 10

######################

why is it that during FETCHSIZE
I can use @arr, like I do in the print statement.
But when I want to invoke STORESIZE, I have to
use $#arr instead of @arr=8;  ???

shouldn't @arr be scalar context unless it
is fetching or storing a list? if I wanted to
store a list into @arr, I would have said
@arr = ( 10 );

this makes it a pain to use because I have
to use $#arr to assign to it, but @arr to
read it.

$#arr = 8;
my $val = @arr;

it's just weird.

is there a way to assign to @arr and have it
kick into STORESIZE instead of just STORE?
The whole idea is to have code that looks like
this:

@arr=8;
$arr[1]=1;
my $value = @arr;

<\DennisMiller>
_______________________________________________
Boston-pm mailing list
[EMAIL PROTECTED]
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to