[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gawk] array initialization

From: Andrew J. Schorr
Subject: Re: [bug-gawk] array initialization
Date: Sat, 5 Jan 2019 09:35:30 -0500
User-agent: Mutt/1.5.21 (2010-09-15)

On Sat, Jan 05, 2019 at 09:57:56AM +0100, Wolfgang Laun wrote:
> IMH, it would be preferable if you can avoid burdening the user with thinking
> about getting some optimum _implementation._
> Idea: whenever the last element of an array is deleted, revert its type to
> "null". The element added next will select the new type.

I agree. It might be nice to have an explicit statement or function for
declaring an array, but it makes sense to me to reset the array type
when the last element is deleted.

I think the attached patch may do the trick, but I am far from certain,
particularly since I'm a bit feverish at the moment. It passes "make check".

It remains difficult to debug these types of issues because typeof doesn't shed
any light on the backend array type. One could imagine adding an optional
second argument to typeof that will contain an array returning various
attributes of the variable, with no guarantee of stability across releases.
The array could contain various attributes with information about the internal
representation of the variable. I don't believe this can be done in an
extension because the implementation details are hidden by the API.

Another idea is to add a debug statement similar to adump that would display
these implementation details. Thoughts?


Attachment: array_reset.patch
Description: Text document

reply via email to

[Prev in Thread] Current Thread [Next in Thread]