On Thursday 04 April 2013 10:20:50 Chet Ramey wrote:
> On 4/4/13 12:34 AM, Mike Frysinger wrote:
> >>> would it be possible to enable a mode where you had to explicitly
> >>> `declare +r` the var ? being able to "simply" do `local FOO` allows
> >>> accidental overriding in sub funcs where the writ
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On 4/4/13 12:34 AM, Mike Frysinger wrote:
>> Yes, this has come up before. It's one reason to keep the compromise in
>> place. But is FOO being readonly in the function where it's declared and
>> not being able to unset it enough rationale to contin
On Wednesday 03 April 2013 21:38:19 Chet Ramey wrote:
> On 4/3/13 12:31 PM, Mike Frysinger wrote:
> > sounds like the fundamental limitation is that the person writing the
> > code can't declare their intentions. after your compromise, they now
> > can. if you follow the convention of putting all
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On 4/3/13 12:31 PM, Mike Frysinger wrote:
> sounds like the fundamental limitation is that the person writing the code
> can't declare their intentions. after your compromise, they now can. if you
> follow the convention of putting all code into a
On Wednesday 03 April 2013 09:34:18 Chet Ramey wrote:
> A variable is declared readonly for a reason, and, since readonly variables
> may not be assigned to, I don't believe you should be able to override a
> readonly variable by declaring it local to a function. I did, however
> reluctantly, allo
On 4/3/13 4:21 AM, Pierre Gaston wrote:
> On Wed, Apr 3, 2013 at 11:03 AM, Chris Down wrote:
>
>> On 2013-04-03 11:00, Nikolai Kondrashov wrote:
>> It doesn't work because you are trying to redefine an existing
>> readonly variable.
>
> Yes, but I'm explicitly redefining it locall
On Wed, Apr 3, 2013 at 11:50 AM, Chris F.A. Johnson wrote
>
> Still Nikolai has a point.
>
> It's not clear why readonly variable can be overridden when the
variable is declared readonly in the scope of an englobing
function but not if it is declared readonly in the global sco
On Wed, 3 Apr 2013, Pierre Gaston wrote:
On Wed, Apr 3, 2013 at 11:33 AM, Chris F.A. Johnson wrote:
On Wed, 3 Apr 2013, Pierre Gaston wrote:
On Wed, Apr 3, 2013 at 11:03 AM, Chris Down wrote:
On 2013-04-03 11:00, Nikolai Kondrashov wrote:
It doesn't work because you are trying to redefin
Chris Down, Chris F.A. Johnson and Pierre Gaston,
thank you all for quick replies!
I now see that this is a known behavior and is considered normal by
developers.
Although, I'd say that it feels unnatural.
On 04/03/2013 11:26 AM, Pierre Gaston wrote:
ok it has indeed been discussed, and this
On Wed, Apr 3, 2013 at 11:33 AM, Chris F.A. Johnson wrote:
> On Wed, 3 Apr 2013, Pierre Gaston wrote:
>
> On Wed, Apr 3, 2013 at 11:03 AM, Chris Down wrote:
>>
>> On 2013-04-03 11:00, Nikolai Kondrashov wrote:
>>>
It doesn't work because you are trying to redefine an existing
>>> read
On Wed, 3 Apr 2013, Pierre Gaston wrote:
On Wed, Apr 3, 2013 at 11:03 AM, Chris Down wrote:
On 2013-04-03 11:00, Nikolai Kondrashov wrote:
It doesn't work because you are trying to redefine an existing
readonly variable.
Yes, but I'm explicitly redefining it locally, only for this function
On Wed, Apr 3, 2013 at 11:21 AM, Pierre Gaston wrote:
> On Wed, Apr 3, 2013 at 11:03 AM, Chris Down wrote:
>
>> On 2013-04-03 11:00, Nikolai Kondrashov wrote:
>> > >>>It doesn't work because you are trying to redefine an existing
>> > >>>readonly variable.
>> > >>
>> > >>Yes, but I'm explicitly r
On Wed, Apr 3, 2013 at 11:03 AM, Chris Down wrote:
> On 2013-04-03 11:00, Nikolai Kondrashov wrote:
> > >>>It doesn't work because you are trying to redefine an existing
> > >>>readonly variable.
> > >>
> > >>Yes, but I'm explicitly redefining it locally, only for this function.
> > >>And this wo
On Wed, 3 Apr 2013, Nikolai Kondrashov wrote:
On 04/03/2013 10:53 AM, Chris Down wrote:
On 2013-04-03 10:50, Nikolai Kondrashov wrote:
On 04/03/2013 10:43 AM, Chris F.A. Johnson wrote:
On Wed, 3 Apr 2013, Nikolai Kondrashov wrote:
I.e. this:
bash -c 'declare -r v; a() { declare -r v; }; a'
On 04/03/2013 10:53 AM, Chris Down wrote:
On 2013-04-03 10:50, Nikolai Kondrashov wrote:
On 04/03/2013 10:43 AM, Chris F.A. Johnson wrote:
On Wed, 3 Apr 2013, Nikolai Kondrashov wrote:
I.e. this:
bash -c 'declare -r v; a() { declare -r v; }; a'
Results in:
bash: line 0: declare: v: readonly
On 2013-04-03 11:00, Nikolai Kondrashov wrote:
> >>>It doesn't work because you are trying to redefine an existing
> >>>readonly variable.
> >>
> >>Yes, but I'm explicitly redefining it locally, only for this function.
> >>And this works for variables previously defined in the calling function.
> >
On 04/03/2013 10:53 AM, Nikolai Kondrashov wrote:
Moreover, this:
bash -c 'a() { v=2; }; b () { v=1; a; echo "$v"; }; b'
Sorry, forgot "declare", should be this instead:
bash -c 'a() { v=2; }; b () { declare v=1; a; echo "$v"; }; b'
Sincerely,
Nick
On 2013-04-03 10:50, Nikolai Kondrashov wrote:
> On 04/03/2013 10:43 AM, Chris F.A. Johnson wrote:
> >On Wed, 3 Apr 2013, Nikolai Kondrashov wrote:
> >>I.e. this:
> >>
> >>bash -c 'declare -r v; a() { declare -r v; }; a'
> >>
> >>Results in:
> >>
> >>bash: line 0: declare: v: readonly variable
> >
It works because both instances are local to a function and don't
exist outside their own functions.
Not true.
This:
bash -c 'a() { echo "$v"; }; b() { declare -r v=123; a; }; b'
Produces this:
123
Moreover, this:
bash -c 'a() { v=2; }; b () { v=1; a; echo "$v"; }; b'
Produces this:
On 04/03/2013 10:43 AM, Chris F.A. Johnson wrote:
On Wed, 3 Apr 2013, Nikolai Kondrashov wrote:
I.e. this:
bash -c 'declare -r v; a() { declare -r v; }; a'
Results in:
bash: line 0: declare: v: readonly variable
It doesn't work because you are trying to redefine an existing
readonly variabl
On Wed, 3 Apr 2013, Nikolai Kondrashov wrote:
Hi everyone,
It seems Bash 4.2.37 doesn't allow functions to redefine global constants
locally, yet it allows redefining constants local to calling functions.
Is this as supposed to be, or is it a bug?
I.e. this:
bash -c 'declare -r v; a() { de
Hi everyone,
It seems Bash 4.2.37 doesn't allow functions to redefine global constants
locally, yet it allows redefining constants local to calling functions.
Is this as supposed to be, or is it a bug?
I.e. this:
bash -c 'declare -r v; a() { declare -r v; }; a'
Results in:
bash: line
22 matches
Mail list logo