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

Re: [PATCH][RFC] check for heap memory in zfree()



On Mar 6, 10:32am, Peter Stephenson wrote:
}
} Bart Schaefer wrote:
} > IMO a unique array is a distinct type from an ordinary array.
} 
} I'm not convinced about that.  I think it's just a tidying up operation
} performed on the value.

If it only happened on output, like -LRZ, I'd agree with you.  But then
it would be worse than useless for dirstack.

} > For example, although you can (without getting warnings) set the -LRZ
} > options on any array, they don't have any effect except to make the
} > array show up in "typeset -LRZ" output.
} 
} That's a bug, probably, although it might need care fixing (does the
} flag apply if the array is about to be joined?)

I'd be tempted to say they apply when joining with $arr[@] but not with
$arr[*], but -Z gives me pause.  I guess I think -LR should work like
${(l:N:)...} and ${(r:N:)...}, which is where the [@] [*] distinction
comes from.  I wish (l) were for lower-case and (r) for match-rest so
we could have (L:N:) (R:N:) and add (Z:N:), but it's years too late now.

} It doesn't make sense to have dirstack an integer, but it does makes
} sense to have it contain unique elements.

That could be made to "work" for dirstack by adopting something like
Andrey's 22320, where the set-fn is not called until after the new
flags are in place.  dirssetfn() could then check for PM_UNIQUE and
frob PUSHD_IGNORE_DUPS to match.

I think that would be even more broken, though.  The number of possible
bad interactions doubles -- people would be confused about why their
change to setopt reverts whenever they assign to dirstack, etc.

-- 



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