Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Questions about FixedBooleanArray and ResizeBooleanArray

4 views
Skip to first unread message

Karl Forner

unread,
Oct 2, 2006, 7:58:09 PM10/2/06
to Internals List
Hi,

I coud not find detailed specifications for these PMCs, so I was wondering
what should happen
when they are (re)sized.

For example:
a = new FixedBooleanArray
a = 3

So a has been (re)sized in order to be able to hold 3 elements, but what
should be the value of these elements ?
Do they have a default value ?
Should they be marked as "undefined" ?
'cause for now it seems that these PMCs do not implement the "defined"
interface. Should they ?

A last question:
By looking in the source code, I noticed that the implementation of
get_integer_keyed_int() in ResizeBooleanArray allows negative indexes
while not in FixedBooleanArray. Is it expected ?
Are there any specs or guidelines for that sort of stuff ?

Thanks,
Karl Forner

Leopold Toetsch

unread,
Oct 3, 2006, 2:51:40 AM10/3/06
to perl6-i...@perl.org
Am Dienstag, 3. Oktober 2006 01:58 schrieb Karl Forner:
> Hi,
>
> I coud not find detailed specifications for these PMCs, so I was wondering
> what should happen
> when they are (re)sized.

The Fixed* variants don't resize.
Yes unfilled are is set to the default value. See below

> For example:
> a = new FixedBooleanArray
> a = 3
>
> So a has been (re)sized in order to be able to hold 3 elements, but what
> should be the value of these elements ?

1 bit: 0 or 1

> Do they have a default value ?

Yes.
Boolean: 0
Int: 0
Float: 0.0
PMC: PMCNULL
STRING: NULL

> Should they be marked as "undefined" ?

There's no storage room in e.g. *BooleanArray for that.

> 'cause for now it seems that these PMCs do not implement the "defined"
> interface. Should they ?

Defined doesn't make much sense for native values.

> A last question:
> By looking in the source code, I noticed that the implementation of
> get_integer_keyed_int() in ResizeBooleanArray allows negative indexes
> while not in FixedBooleanArray. Is it expected ?

It ought to be consistent.

> Are there any specs or guidelines for that sort of stuff ?

Not yet AFAIK.

>
> Thanks,
> Karl Forner

leo

0 new messages