This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

0's & NULLs in associative arrays


In the systemtap meeting this morning we discussed whether systemtap should allow 0's to be stored in array elements. Currently, storing a 0 deletes the element, which means the membership check and foreach statements can't see it. Here's what I recall from the discussion.

Some concerns were:
- might break some existing scripts
- this is the way Dtrace does it
- current implementation simplifies the API.  You don't have to check if an index exists before reading it.  Simplifies the implementation.
- not auto deleting 0 elements will take up more space

It was also mentioned that someone might want to increment/decrement an element value and have it auto delete when it reaches zero. No one thought this was a required behavior. This can also be done with an explicit delete.

Someone said this behavior is not documented and no one should depend on it in their scripts. However, the tutorial does say "Assigning a null value in effect deletes the element" on page 8. That's the only mention I've found.

I believe the consensus was to change the behavior such that elements are *not* deleted when set to 0, essentially removing the auto delete feature. These elements could then be seen by the membership check and foreach statements. All other behavior would remain the same (i.e, referencing nonexistent elements still returns 0).

Can anybody think of a reason not to make this change?








Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]