bug-bash
[Top][All Lists]
Advanced

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

Re: test '-v' - associative vs. normal array discrepancy - a bug ?


From: Piotr Grzybowski
Subject: Re: test '-v' - associative vs. normal array discrepancy - a bug ?
Date: Wed, 19 Nov 2014 23:03:33 +0100

On Wed, Nov 19, 2014 at 10:48 PM, Greg Wooledge <wooledg@eeg.ccf.org> wrote:
>
> No, I don't.

 I completely respect that.

>
> If I'm writing in C, and I want to know whether one of my variables is
> "empty", I have to know what type of variable it is.  The code to check
> whether a string (char x[10]) is "empty" is very different from the code
> to check whether an array of integers (int x[10]) is "empty".  Hell,
> the meaning of "empty" would have to be defined by the application.
> Would it mean every element is 0?  Or something else?  And what if x is
> a float, or a double?  Or a pointer?  Or a struct?

 exactly. why is that? you touched the most important thing: types.
thats why in script languages, where you do not define variables with
types as such, you have the meaning of "empty", a="" makes a empty,
declare -A b makes b empty.

>
> The same thing happens in bash.  It's simply not the kind of language
> where you have one syntax that works for multiple situations.

 well, I could argue:) but I wont.
 I see your point.

cheers,
pg



reply via email to

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