Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: POSIX_BUILTINS and readonly parameters, again



On Wed, 25 Nov 2015 16:33:51 -0800
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> Conversely if POSIXBUILTINS is set, readonly variables are unset unless
> assigned in the declaration 

Right, that was the point.

> [good thing we fixed array assignment there]:

Actually, that reminds me...

  % readonly -a foo=(one two)
  % readonly -p
  typeset -a foo
  foo=( one two )
  typeset -ar foo

We don't need to make such heavy weather of this now.  But that can
wait.
 
> So the only reason for testing isset(POSIXBUILTINS) in createparam() is
> the case where POSIXBUILTINS *changes* between time of declaration and
> time of assignment:

I'm sure your analysis is correct, however the rule we were trying to
implement starts "if POSIXBUILTINS is set ..." (and then goes on about
readonly and unset variables).  It seems peverse to have to analyse the
whole sequence and decide that part of the change is actually benign in
other cases when that's not really relevant to what's being implemented.

However, removing the test with a suitable comment about the effect of
the code, now you've worked it out, would certainly be a valid
alternative approach.

pws



Messages sorted by: Reverse Date, Date, Thread, Author